mattiasnordin / StataEditor

Stata Editor for Sublime Text 3
47 stars 18 forks source link

Stata highlighting #7

Closed alejandromolnar closed 8 years ago

alejandromolnar commented 8 years ago

Hi Mattias, just letting you know the new update broke highlighting.

I'm not sure exactly what causes it but I have instances where it happens where a line has two ìnstances of "dereferencing" a local (i.e. x' followed byy')

Also, since I'm writing about this I'll mention that an earlier change you made (changing default comment-out from * to ) isn't ideal for me, since I often copy+paste in interactive mode, and I suspect that it might not have much general use to others since the only benefit of starting a comment with "//" instead of "*" lies in adding a comment on the same line after a command, which is not something one would use a text-editor's block-comment feature for.

Thanks again for your work, Best, Alejandro

mattiasnordin commented 8 years ago

I am not entirely clear what the issue is, but I have now updated the editor to fix broken syntax highlighting. Please let me know if it is working.

Regarding the commenting: This was discussed in issue #4 and people have different opinions on it. Note that the block comment feature still gives you /* */. If you want to change it back, you can save the following code in a file called Comments.tmPreferences and put it in your user folder (likely located at C:\Users\yourusername\AppData\Roaming\Sublime Text 3\Packages\User):

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

name Comments scope source.stata settings shellVariables name TM_COMMENT_START value \* name TM_COMMENT_START_2 value /\* name TM_COMMENT_END_2 value */ uuid 2acd5675-c810-4d05-a2e0-cdeda4c9d847
alejandromolnar commented 8 years ago

Thanks a lot Mattias, syntax highlighting working fine now.

I'll just add my opinion to the debate you already had on this, with no intention of starting an internet flame-war!

In my opinion there's nothing wrong with operator overloading in a high-level, scripting language such as Stata's. Overloading operators is a trade-off with the benefit of keeping things readable, and is (partly) why Stata scripts are so much more readable than R scripts.

Computer Science pursists might disagree, but they have trade-offs for low-level languages in mind that are not relevant to Stata users. For syntax highlighting, markup, etc., the "* as comment" overload of * is the easiest to handle in regex: it only applies at the start of a line.

Anyway, added purely for the benefit of discussion and very thankful for your work, and thanks for the instructions on how to add an exception. Best, Alejandro

mattiasnordin commented 8 years ago

Great! I don't have a strong opinion on this issue myself. I'm going to leave commenting the way it is for now, but I'm open to changing it in the future.