jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
156 stars 30 forks source link

Where do source.asm / x86 / etc. come from? #522

Open asottile opened 4 years ago

asottile commented 4 years ago

👋 I notice this grammar includes various assembly grammars, I was wondering what you use to supply them (some searching around I couldn't find any sources for these that worked -- for now I'm stubbing out those grammars)

jeff-hykin commented 4 years ago

So we actually don't know! haha. The user can install whatever they want an VS Code will fill it in automatically if it is available.

For example here's an issue that exists for one of the ARM versions of souce.asm https://github.com/dan-c-underwood/vscode-arm/issues/15

asottile commented 4 years ago

ah cool, I was curious if there was one you used 😆

I couldn't find a good source.asm so I might make one myself :S

jeff-hykin commented 4 years ago

Oh haha! sorry. This is the one I have installed. Obviously only works for x86 https://marketplace.visualstudio.com/items?itemName=13xforever.language-x86-64-assembly

asottile commented 4 years ago

hmmm I don't think that one gets included by the code in this repo as it has scopeName of source.asm.x86_64: https://github.com/13xforever/x86_64-assembly-vscode/blob/67682ff90de1a675e7224c6555aa78eb44445c00/syntaxes/language-x86_64-assembly.tmLanguage#L2023

this doesn't match the include here: https://github.com/jeff-hykin/cpp-textmate-grammar/blob/6f039d2bccfd6822edeb112deb0d88e9eceefcdf/syntaxes/c.tmLanguage.json#L3012

matter123 commented 4 years ago

It gets matched under source.asm.

The assembly language scopes are purposefully generic. As the standard mandates no particular syntax for inline assembly blocks, there is little the grammar can do. The provided scopes attempt to match a scope of whatever third party assembly language the user has installed, under the assumption that the user installed/enabled the assembly grammar corresponding to what their project uses.

asottile commented 4 years ago

oh what, I didn't know includes did prefix matching 🤦 guess I have to go fix my highlighter