Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Colour formatting gets confused due in specific situations with comment lines and another string containing lots of commas #440

Open
1 task done
adam-jones-net opened this issue Aug 11, 2021 · 1 comment

Comments

@adam-jones-net
Copy link

Prerequisites

Description

Colour formatting gets confused due in specific situations with comment lines and another string containing lots of commas.

Steps to Reproduce

Create a new PHP file in atom and then paste the following code into it.

<?php
//
$query='SELECT test1, test2, test3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';
// the colour formatting should be broken already by the time of this comment line
?>

Expected behavior:

Normal colouring of syntax

Actual behavior:

The colour syntax is wrong. Delete either the top "//" or some of the content in the $query variable and it resolves itself.

Reproduces how often:

All the time

Versions

Atom : 1.58.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1
Windows 10 Build 21H1

@KapitanOczywisty
Copy link
Contributor

@Arkid This is caused by token limit per one line, which is equal to 100 by default. Each coma is treated as separate token.

If you need this limit increased you can add Init script

// init.js
let php = atom.grammars.grammarForScopeName('text.html.php');
// tokens per line (default: 100)
php.maxTokensPerLine = 200;
// tokenize until N characters per line (default: 1000)
// php.maxLineLength = 2000;

And coffee variant

# init.coffee
php = atom.grammars.grammarForScopeName('text.html.php')
php.maxTokensPerLine = 200
# php.maxLineLength = 2000

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants