Context 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;
}







0















I'm developing a language to write down mathematical proofs for proof checking. (To be more accurate: it is a language to write down derivations in Post canonical systems)



Is it possible to create syntax highlighting for VS Code, Sublime Text or Atom which will do something like this:





So I'm asking for context dependent syntax highlighting. Only the "declared" variables should be highlighted (until the next variable declaration).



Of course, with a custom lexer in Pygments it is possible. But the TextMate-like grammars seem to be too limited. If this is the case: Is there a code editor that can use something like Pygments to highlight code?



Remark:




  1. It isn't important what happens if one variable is an initial segment of another.

  2. The semantical content of the example is nonsense, of course.










share|improve this question

























  • I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

    – OdatNurd
    Nov 16 '18 at 19:14











  • Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

    – idleberg
    Nov 17 '18 at 18:13




















0















I'm developing a language to write down mathematical proofs for proof checking. (To be more accurate: it is a language to write down derivations in Post canonical systems)



Is it possible to create syntax highlighting for VS Code, Sublime Text or Atom which will do something like this:





So I'm asking for context dependent syntax highlighting. Only the "declared" variables should be highlighted (until the next variable declaration).



Of course, with a custom lexer in Pygments it is possible. But the TextMate-like grammars seem to be too limited. If this is the case: Is there a code editor that can use something like Pygments to highlight code?



Remark:




  1. It isn't important what happens if one variable is an initial segment of another.

  2. The semantical content of the example is nonsense, of course.










share|improve this question

























  • I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

    – OdatNurd
    Nov 16 '18 at 19:14











  • Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

    – idleberg
    Nov 17 '18 at 18:13
















0












0








0








I'm developing a language to write down mathematical proofs for proof checking. (To be more accurate: it is a language to write down derivations in Post canonical systems)



Is it possible to create syntax highlighting for VS Code, Sublime Text or Atom which will do something like this:





So I'm asking for context dependent syntax highlighting. Only the "declared" variables should be highlighted (until the next variable declaration).



Of course, with a custom lexer in Pygments it is possible. But the TextMate-like grammars seem to be too limited. If this is the case: Is there a code editor that can use something like Pygments to highlight code?



Remark:




  1. It isn't important what happens if one variable is an initial segment of another.

  2. The semantical content of the example is nonsense, of course.










share|improve this question
















I'm developing a language to write down mathematical proofs for proof checking. (To be more accurate: it is a language to write down derivations in Post canonical systems)



Is it possible to create syntax highlighting for VS Code, Sublime Text or Atom which will do something like this:





So I'm asking for context dependent syntax highlighting. Only the "declared" variables should be highlighted (until the next variable declaration).



Of course, with a custom lexer in Pygments it is possible. But the TextMate-like grammars seem to be too limited. If this is the case: Is there a code editor that can use something like Pygments to highlight code?



Remark:




  1. It isn't important what happens if one variable is an initial segment of another.

  2. The semantical content of the example is nonsense, of course.







visual-studio-code editor sublimetext3 syntax-highlighting atom-editor






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 20:46







Popov Florino

















asked Nov 16 '18 at 11:44









Popov FlorinoPopov Florino

11




11













  • I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

    – OdatNurd
    Nov 16 '18 at 19:14











  • Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

    – idleberg
    Nov 17 '18 at 18:13





















  • I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

    – OdatNurd
    Nov 16 '18 at 19:14











  • Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

    – idleberg
    Nov 17 '18 at 18:13



















I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

– OdatNurd
Nov 16 '18 at 19:14





I don't know any details about the other editors you mentioned, but this is not possible in Sublime Text; the syntax system it uses (even the one that is enhanced over the TextMate style tmLanguage syntax variant) allows context sensitivity in the form of extra rules that apply in contextually defined situations, but those rules need to be pre-defined in the syntax ahead of time.

– OdatNurd
Nov 16 '18 at 19:14













Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

– idleberg
Nov 17 '18 at 18:13







Essentially it's possible in both, Atom and Visual Studio Code. Both are based on Electron, so in a nutshell they work and can be programmed like browser. You can use JavaScript to manipulate the DOM, e.g. insert syntax-highlighting classes for dynamically determined strings. But this is far beyond the scope of a StackOverflow question. You are invited to come back with specific problems along the way. The Atom discussion forum is a friendly community that probably can help you.

– idleberg
Nov 17 '18 at 18:13














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%2f53337212%2fcontext-dependent-syntax-highlighting-in-vs-code-sublime-or-atom%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%2f53337212%2fcontext-dependent-syntax-highlighting-in-vs-code-sublime-or-atom%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

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma