Is it possible to dynamically add “keywords” in VS Code syntax highlighting?Language server with semantic highlight in VSCodeSyntax highlighting code with JavascriptHow to manually set language for syntax highlighting in Visual Studio CodeDifferent syntax highlighting for sub-types of comments (?)Creating Visual Studio Code extension for syntax highlighting of a custom languageHow to highlight javascript syntax inside a string?Visual Studio Code Syntax HighLighting tmLanguage.jsonsyntax highlighling by visual studio codeContext dependent syntax highlighting in vs code, sublime or atom

How to trick the reader into thinking they're following a redshirt instead of the protagonist?

Error 57 when installing Liquidity

Ability To Change Root User Password (Vulnerability?)

What's the difference between the Add and Linear Dodge blend modes in After Effects?

Has there been a multiethnic Star Trek character?

What would be the way to say "just saying" in German? (Not the literal translation)

Electricity free spaceship

Bb13b9 confusion

Can the removal of a duty-free sales trolley result in a measurable reduction in emissions?

What does 思ってやっている mean?

Why does ''cat "$1:-/dev/stdin | ... &>/dev/null'' work in bash but not dash?

Excel division by 0 error when trying to average results of formulas

Teaching a class likely meant to inflate the GPA of student athletes

Getting UPS Power from One Room to Another

Is using 'echo' to display attacker-controlled data on the terminal dangerous?

What aircraft was used as Air Force One for the flight between Southampton and Shannon?

Which languages would be most useful in Europe at the end of the 19th century?

What is the color of artificial intelligence?

Does the new finding on "reversing a quantum jump mid-flight" rule out any interpretations of QM?

How can I end combat quickly when the outcome is inevitable?

Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?

Longest bridge/tunnel that can be cycled over/through?

Advantages of the Exponential Family: why should we study it and use it?

Specific use case of to_address



Is it possible to dynamically add “keywords” in VS Code syntax highlighting?


Language server with semantic highlight in VSCodeSyntax highlighting code with JavascriptHow to manually set language for syntax highlighting in Visual Studio CodeDifferent syntax highlighting for sub-types of comments (?)Creating Visual Studio Code extension for syntax highlighting of a custom languageHow to highlight javascript syntax inside a string?Visual Studio Code Syntax HighLighting tmLanguage.jsonsyntax highlighling by visual studio codeContext dependent syntax highlighting in vs code, sublime or atom






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I've been playing around with syntax highlighting in VS Code and have so far been able to get a pretty good result using a custom JSON TextMate grammar. Although an extension already existed for GCC ARM Assembly, I thought it sucked, so I used the source code as a starting point to make my own.



However, there is a scenario I can't seem to figure out how to handle. In GCC ARM you can use the .macro directive to create macros like this:



 .macro print format, storage
.data
string@: .asciz "format"
.align 2
.text
.ifnb storage
mov r1, storage
.endif
ldr r0, =string@
bl printf
.endm


If you've never looked at GCC ARM, all you need to know is that the first line starts the macro, where print is the name of the macro and format and storage are its arguments. Then inside the macro you can use values of the arguments with format and storage anywhere you want. There is also @, which is a special "variable" which only has meaning inside macros. All it is is a number that increments every time the macro is called.



What I'd like to do is somehow write syntax highlighting that will dynamically recognize the argument names in the macro declaration and then color their corresponding usages (starting with forward slashes) wherever they appear inside the macro. The problem with this seems to be that I will need to somehow dynamically create a list of new "keywords" (or whatever you would like to call the strings of text) that I can refer back to from rules inside the macro context.



Is this possible in VS Code with TextMate grammars? Is it possible in VS Code at all? If not, is it possible in ANY editor? If not possible with TextMate grammars, what would I have to do to achieve this?



Feel free to ask for more details if there is anything I explained poorly and I will edit the question.










share|improve this question



















  • 1





    I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

    – Gama11
    Mar 24 at 21:51

















1















I've been playing around with syntax highlighting in VS Code and have so far been able to get a pretty good result using a custom JSON TextMate grammar. Although an extension already existed for GCC ARM Assembly, I thought it sucked, so I used the source code as a starting point to make my own.



However, there is a scenario I can't seem to figure out how to handle. In GCC ARM you can use the .macro directive to create macros like this:



 .macro print format, storage
.data
string@: .asciz "format"
.align 2
.text
.ifnb storage
mov r1, storage
.endif
ldr r0, =string@
bl printf
.endm


If you've never looked at GCC ARM, all you need to know is that the first line starts the macro, where print is the name of the macro and format and storage are its arguments. Then inside the macro you can use values of the arguments with format and storage anywhere you want. There is also @, which is a special "variable" which only has meaning inside macros. All it is is a number that increments every time the macro is called.



What I'd like to do is somehow write syntax highlighting that will dynamically recognize the argument names in the macro declaration and then color their corresponding usages (starting with forward slashes) wherever they appear inside the macro. The problem with this seems to be that I will need to somehow dynamically create a list of new "keywords" (or whatever you would like to call the strings of text) that I can refer back to from rules inside the macro context.



Is this possible in VS Code with TextMate grammars? Is it possible in VS Code at all? If not, is it possible in ANY editor? If not possible with TextMate grammars, what would I have to do to achieve this?



Feel free to ask for more details if there is anything I explained poorly and I will edit the question.










share|improve this question



















  • 1





    I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

    – Gama11
    Mar 24 at 21:51













1












1








1








I've been playing around with syntax highlighting in VS Code and have so far been able to get a pretty good result using a custom JSON TextMate grammar. Although an extension already existed for GCC ARM Assembly, I thought it sucked, so I used the source code as a starting point to make my own.



However, there is a scenario I can't seem to figure out how to handle. In GCC ARM you can use the .macro directive to create macros like this:



 .macro print format, storage
.data
string@: .asciz "format"
.align 2
.text
.ifnb storage
mov r1, storage
.endif
ldr r0, =string@
bl printf
.endm


If you've never looked at GCC ARM, all you need to know is that the first line starts the macro, where print is the name of the macro and format and storage are its arguments. Then inside the macro you can use values of the arguments with format and storage anywhere you want. There is also @, which is a special "variable" which only has meaning inside macros. All it is is a number that increments every time the macro is called.



What I'd like to do is somehow write syntax highlighting that will dynamically recognize the argument names in the macro declaration and then color their corresponding usages (starting with forward slashes) wherever they appear inside the macro. The problem with this seems to be that I will need to somehow dynamically create a list of new "keywords" (or whatever you would like to call the strings of text) that I can refer back to from rules inside the macro context.



Is this possible in VS Code with TextMate grammars? Is it possible in VS Code at all? If not, is it possible in ANY editor? If not possible with TextMate grammars, what would I have to do to achieve this?



Feel free to ask for more details if there is anything I explained poorly and I will edit the question.










share|improve this question
















I've been playing around with syntax highlighting in VS Code and have so far been able to get a pretty good result using a custom JSON TextMate grammar. Although an extension already existed for GCC ARM Assembly, I thought it sucked, so I used the source code as a starting point to make my own.



However, there is a scenario I can't seem to figure out how to handle. In GCC ARM you can use the .macro directive to create macros like this:



 .macro print format, storage
.data
string@: .asciz "format"
.align 2
.text
.ifnb storage
mov r1, storage
.endif
ldr r0, =string@
bl printf
.endm


If you've never looked at GCC ARM, all you need to know is that the first line starts the macro, where print is the name of the macro and format and storage are its arguments. Then inside the macro you can use values of the arguments with format and storage anywhere you want. There is also @, which is a special "variable" which only has meaning inside macros. All it is is a number that increments every time the macro is called.



What I'd like to do is somehow write syntax highlighting that will dynamically recognize the argument names in the macro declaration and then color their corresponding usages (starting with forward slashes) wherever they appear inside the macro. The problem with this seems to be that I will need to somehow dynamically create a list of new "keywords" (or whatever you would like to call the strings of text) that I can refer back to from rules inside the macro context.



Is this possible in VS Code with TextMate grammars? Is it possible in VS Code at all? If not, is it possible in ANY editor? If not possible with TextMate grammars, what would I have to do to achieve this?



Feel free to ask for more details if there is anything I explained poorly and I will edit the question.







visual-studio-code syntax-highlighting grammar vscode-extensions tmlanguage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 13:40









Gama11

14k52652




14k52652










asked Mar 24 at 19:23









Aaron BeaudoinAaron Beaudoin

307315




307315







  • 1





    I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

    – Gama11
    Mar 24 at 21:51












  • 1





    I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

    – Gama11
    Mar 24 at 21:51







1




1





I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

– Gama11
Mar 24 at 21:51





I don't think it's possible with a TextMate grammar, this is more in the realm of semantic highlighting (which is not supported by VSCode yet: stackoverflow.com/questions/35287143/…).

– Gama11
Mar 24 at 21:51












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327617%2fis-it-possible-to-dynamically-add-keywords-in-vs-code-syntax-highlighting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327617%2fis-it-possible-to-dynamically-add-keywords-in-vs-code-syntax-highlighting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴