Grammar generator mishandles name property with embedded scopes #16
Comments
This also happens with other Typescript scopes: https://discuss.atom.io/t/cant-seem-to-style-element-based-on-cursor-scope/51526 |
Bump. Is anyone actually responsible for this project at the moment? |
@lierdakil The team was on a bug bash and retreat last month so we are somewhat behind on triage. |
Any updates? |
The grammar comes from upstream and is supposed to work in a variety of editors - from their README;
I'm not aware that any other editor can handle spaces in the names correctly besides VSCode so either that upstream repository isn't the one we all want to use after all or they need to consider not closing the issue with "works in VSCode" :( |
Might it might be easier to fix on Atom side?.. At least I believe a quick fix should amount to a single-line change (didn't look at the sources yet though, so allow for a ± couple lines). A "correct" fix might prove to be a bit more involved, but probably not drammatically so. |
The problem is if I hack the grammar files here then we're effectively detached from upstream unless we keep remembering to make those changes every time we pull... Also not sure what the right fix would actually be. Sure they've put multiple grammar scope names in a name but there isn't an Atom-compatible syntax for that so we'd just have to choose one or come up with some kind of combo name. Open to suggestions or PRs (should probably sync upstream again before anyone bothers with that) |
I was more thinking along the lines of patching first-mate to handle scopes with spaces actually. A technically "correct" fix on the grammar side would be a scope-within-a-scope. So essentially (and forgive me if it doesn't work, it was a while since I last touched grammar) match: '...'
name: 'meta.definition.function.ts'
captures: 0: name: 'entity.name.function.ts' ... although it isn't nestable, or at least I can't say from the top of my head how it could be. |
And by "nestable" I actually meant "can handle more than two scopes". Sorry, long day. |
Prerequisites
Description
Grammar generator mis-handles
name
property with embedded scopes, for example:language-typescript/grammars/TypeScript.json
Line 799 in 1927633
FirstMate can't handle this syntax, and as a result, source span gets the class
syntax--meta syntax--definition syntax--function syntax--ts entity syntax--name syntax--function syntax--ts
. Notice the nakedentity
withoutsynax--
prefix there in the middle.This is brought over from TypeStrong/atom-typescript#1379
Steps to Reproduce
log-cursor-scope
onsomeMethod
Expected behavior:
Actual behavior:
Reproduces how often: 100%
Versions
Additional Information
See also: microsoft/TypeScript-TmLanguage#545
The text was updated successfully, but these errors were encountered: