Indent & syntax color


#1

Hi,

Syntax color of a theme we’ve developed won’t be effective untill we ident one space from gutter, bracket or operator. Any hint please ?


#2

It would probably be helpful if you shared a link to your code so that people can see what you might be doing wrong.


#3

Hi, I know that’s been over 1 year ago ! :frowning: but the behaviour of the syntax highlighting as described at that time and its dev was defered…)

So I have the same issue : The syntax color won’t be effective untill we indent one space from gutter, bracket or operator. Any hint please ? I think it’s because of the regexp used ? Is it the ‘s+’ tag ? I’ve tried to get rid of it but sometimes there’s an issue with scan.js… I’m bewildered

Here’s a link to the grammar and we have issues with syntax like :
abort|action|and|at|before|bind|case|closefile|curve|do|during|else|expr|false|forall|gfwd|group|if|imap|in|kill|let|lfwd|loop|map|ms|napro_trace|nim|NIM|noevent|… among others.

https://github.com/nadirB/atom-antescofo/blob/master/grammars/antescofo-grammar.cson

Can you please take a look ?

Best

N.


#4

Lets go with that. instead of \\s+ try using \\s* instead. Very possibly you are looking for a word boundary instead: \\b.

For the best solution, please supply a sample piece of the code that you aim to get highlighted.


#5

//s* won’t do. Thanks for your reply.
Here’s a sample https://github.com/nadirB/atom-antescofo/issues


#6

\\s* mistake


#7

You’ve chosen to post it as a text file on GitHub, which forces people to download it. It would be a better decision to put the sample inside the repo.


#8

Let’s say I do that then I have to tell you to save it in a text file with the extension .asco.txt in order to open it in the editor so that the grammar (atom-antescofo) does the matching… no ?

Besides I’ve edited the text so that it shows the issue, and the issue editor changes the prepared indentation.

Thank you for your comprehension


#9

No, because if your file is in the repo it will be uploaded exactly as it is on your computer.

Besides I’ve edited the text so that it shows the issue, and the issue editor changes the prepared indentation.

I said in the repo, not in the issues. You should have your test files in the same folder as your package code and upload them all with git.


#10

I agree. https://github.com/nadirB/atom-antescofo/blob/master/check_Syntax_highlight.asco.txt

Thanks for your help

N.


#11

Hello.

Not knowing what exactly you are hoping to get, makes it difficult to suggest changes.

You can find a changed file here:
https://gist.github.com/danPadric/4a900bfaea1acaa234385602d5a8358b

Bye


#12

Hi danPadric,

Your were right, I was looking for a word boundary.
Just wanted the syntax highlighting to be effective before the indentation… I know where to look now thanks to you. :slight_smile:

Bye now

N.


#13

Hello.

Do notice that I edited more than just adding a word boundary. Without trying to be disrespectful … the syntax is in a bit of a mess and needs serious review.

Changes include:

  1. Changing the calling order within the grammar coding.
  2. Calling the reserved words section sooner.
  3. Remove duplicates for true and false.
  4. Add block comment identification that uses /* and */.

What I miss:

  1. The identification of the class name is not correct.
  2. File for the grammar setup; including such things as indent width.
  3. color.less file that is referenced in the style sheet giving colours @blue, @green, @red
  4. An actual working sample with some indication to which types the words should be identified for.

The best person to work on the grammar is someone that uses the grammar.

Regards.