DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 302 forks source link

query: alternative syntax definitions break GoSublime? #866

Open kortschak opened 6 years ago

kortschak commented 6 years ago

I am trying out using semantic syntax highlighting. In order to do this in a way that allows me to swap between this and normal Go syntax highlighting I have forked the GoSublime-Go-Legacy.sublime-syntax definition file to put it into a separate name space. (.sem.go instead of .go). The files are here.

With this I can change between "Go" syntax and "Go Semantic" syntax. However, when in sematic syntax highlighting, most of GoSublime/Go functionality goes away; no tab-completion, no fmt on save etc.

I suspect this is just part of how Sublime works, and is possibly offtopic for here, but thought I would ask. Is there a reason using this alternative syntax definition file is breaking the rest of the Go functionality?

kortschak commented 6 years ago

Looking more carefully, it appears that I need to be in source.go to get all the goodies, so I expect I'll just fork all those def files as well.

DisposaBoy commented 6 years ago

I can just add a special-case for source.sem.go. I will push a new release later today or tomorrow, but in the mean time you can change pattern for _scope_lang_pat in gosubl/margo_state.py#L348 to _scope_lang_pat = re.compile(r'(?:source\.\w+|source|text)[.]([^\s.]+)') and restart Sublime Text.

kortschak commented 6 years ago

That's great. Thank you.

kortschak commented 6 years ago

There appears to be a similar situation with CTRL+.CTRL+B (actually all the CTRL+.CTRL+X where X is a GoSublime key (e.g. P, N, T, etc).

DisposaBoy commented 6 years ago

https://github.com/DisposaBoy/GoSublime/issues/852 would probably help here... but there's so few of them (less than 10), so I don't mind just duplicating the bindings until I get around to auto-generation. Many of them need cleaning up anyway e.g. .h and .space don't work and others will become unrestricted like .d