|
Yeah, I already have an app that syntax highlights, and frankly it works better than a rich text box.
I'm really hoping for something more integrated, and wedging my app in in place of an actual native-VS editor because I don't know how to use TextMate seems less than ideal. I'm looking over some of the VS code links, and I hope that stuff transfers to VS. I think they both can use TextMate, although VS has another thing you can use too that's code based.
Real programmers use butterflies
|
|
|
|
|
Do your own file formats contain Program Code or what kind of data?
|
|
|
|
|
Grammars and lexer specs.
The grammars are an attributed variation of EBNF format called XBNF
The lexer specs are my own format, and it's basically attributed name value pairs where the values are either regex expressions or string literals.
Real programmers use butterflies
|
|
|
|
|
Can the VS Editor open/read your files with ParentGrammars and lexer specs?
And would you know a way to add your own highlighting rules to VS / VS Editor?
|
|
|
|
|
To your first question, I don't think so.
To your second question, that's exactly what I'm asking about in the OP.
Real programmers use butterflies
|
|
|
|
|
You wrote earlier:
I want it to support my own file formats, namely XBNF and RL
So you could add those files to your VS project and when it appears in the Project Explorer, try to open it.
|
|
|
|
|
Yes, I already do that. It opens them as plain text files. Why would it do otherwise? It has no way of automatically discerning the syntax. Are you having a go at me?
Real programmers use butterflies
|
|
|
|
|
The easy part is to get syntax highlighting for alternate file extension:
https://stackoverflow.com/questions/21499143/how-to-get-syntax-highlighting-for-alternate-file-extension-for-visual-studio-20
Go to Tools -> Options -> Text Editor -> File Extension And type your alternative extension And then associate it with your editor (e.g. Microsoft Visual C++)
The challenge is to add your custom highlighting list to VS / VS Editor!
|
|
|
|
|
|
There are ways to do it with visual studio as well.
Real programmers use butterflies
|
|
|
|
|
How many different words / strings are in your custom (grammar) file?
Would it be good enough to highlight all of them with the same backcolor?
|
|
|
|
|
I'm tired of this conversation. Look, I told you what I was looking for. The rest is just wasting time, and I'm busy.
Real programmers use butterflies
|
|
|
|
|
Yes, I did some tutorials where Instructors loaded VS Extensions...
IMHO, a bunch of trash! (If you try to take care of your RAM)
|
|
|
|
|
Try to find an existing syntax highlighting extensions that's open source.
|
|
|
|
|
I've found some on github but not really documented.
Real programmers use butterflies
|
|
|
|
|
|
Not sure if that's what you're looking for, and I don't know if it can be used with VS Code, but I'm very happy with the extended coloring and highlighting capabilities of Visual Assist - a Visual Studio extension by Whole Tomato Software[^]
But admittedly the main use I get out of it is its outliner and VA View that gives me a host of information about any symbol I'm currently hovering over. You can find references to any symbol, and unlike Intellisense it will distinguish uses of that specific symbol from uses of a same name symbol from another context. Also the code macros and refactoring options are better than anything offered by Intellisense.
There are a lot more useful features like renaming: renaming a member variable will show you every affected line as context and lets you disable those you don't want changed, and renaming a class within a file of the same name will offer to also change the file names accordingly, as well as adjust #include statements of renamed headers.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I'm looking for ways to extend Visual Studio to highlight my own files. I don't think Visual Assist will help me there? I also don't want end users to have to install it to highlight my files.
Real programmers use butterflies
|
|
|
|
|
You can tell VA to interpret files without extensions as C++ headers, or tell it to interpret files with custum extensions as code files. See
Custom File Extensions[^]
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
honey the codewitch wrote: I also don't want end users to have to install it to highlight my files.
I'm not sure I understand this part. Are you saying you have source files with non-standard extensions that your end users are looking at? If so, then maybe the cost or effort to install VA may not be worth it. However, VisualStudio also has the feature to interpret files with custom extensions as C++. Not sure where in the settings this is hiding. But it would at least enable the built-in highlighting capabilities.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Do you understand HUGE DIFFERENCE between VS and cr@p named VS Code??
|
|
|
|
|
You'll notice there's a complicated word in my post called "and"
Once you figure out what it means, you'll answer your own question.
Real programmers use butterflies
|
|
|
|
|
|
Thanks. I wish they would have written it down instead of making me sit through a video but at this point I'm willing to try it. Thanks again.
Real programmers use butterflies
|
|
|
|
|
I am rather sure, I'll get to write a language server next year. Would something like that help you as well?
|
|
|
|