I want to use VSCode to work on Scala code, but cannot get error highlighting to work.
See some example code below, how it looks like, vs. how I want it to highlight errors.
I think every proper programming language should have code editor support for highlighting of obvious errors regarding undefined variables, functions or operator overloadings.
What can I do, to get error highlighting for Scala in VSCode?
Related
I'm trying to find the files necessary to add my own syntax highlighting to fenced code blocks in a markdown document within Visual Studio Code. e.g.
```Python
# Comment
print("hello world")
```
will provide syntax highlighting for Python. I'm trying to add syntax highlighting for an unsupported language.
I have tried to find these on my own, but it's been all guesswork. I've found what looks like related files under C:\Users<user>\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions. There's a markdown-basics folder within there that contains a syntaxes\markdown.tmLanguage.json that appears to contain fenced code block references, but not the actual syntax definitions. There's also folders for a variety of languages. Trying to create a new definition based on these doesn't seem to work though.
I would appreciate any help figuring out how fenced code block syntax is defined.
I was wondering if there was an easier way of finding an error in the LaTeX document written using Visual Code. Its sometimes the case that there would be an error, such as a missing $ or {} or something similar, and unlike TeXWorks, VS won't show the exact nature of the error. It could be that I am missing something in the output panel.
I am building an experimental lexer generator and I think it would be cool to output simple syntax highlighters for VS Code. The input grammar goes through the classic regular language -> NFA -> DFA transformation, then generates state machine code (it also has some unconventional features to support nested languages). Converting all this back into tmlanguage definitions is a complicated problem, and I'm starting to wonder if a VS Code extension is a better option. The question is:
Are VS Code syntax highlighting internals completely tied to the tmlanguage regex scanner, or would it be possible to write an extension that provides tokens / highlight ranges programmatically?
Is there an API that would make this reasonably straightforward, or would this project be a tour de force?
As of VSCode 1.15, you have to use textmate grammars for syntax highlighting. There's an feature request open that tracks what you are after: https://github.com/Microsoft/vscode/issues/1967
doxygen has support for code fence blocks that also have syntax highlighting in the output.
Here is the documentation:
http://www.doxygen.nl/manual/markdown.html#md_fenced
It looks like this:
~~~{.c}
int somefunc(int somevar);
~~~
I want to support .sql; I tried it, but it did not highlight.
My two questions are:
How do I determine what code types doxygen supports for code fence blocks?
Is there some way to define a new one? I am quite happy with just a keyword highlighter; it does not need to be a full parse.
Since my comment, I have looked into adding SQL syntax highlighting to fenced code blocks and \code blocks.
It should now be available if you build from source at https://github.com/doxygen/doxygen or it will be available in the next version (1.8.13).
Here is an example of the syntax highlighting:
If you could test it before the next release, that would be nice, as well.
We've started using TypeScript along with Emacs as thats our editor of choice.
One issue we have found is that the TypeScript error line format doesn't appear to be compatible with the Emacs compilation mode error handling.
e.g.
If we compile a C program and introduce a deliberate error we get
t1.c:6:5: error: use of undeclared identifier 'a'
If we do the same for the TypeScript compiler we get (ignore the message, its the format thats important)
utilities.ts(13,18): error TS2384: Overload signatures must all be ambient or non-ambient.
Emacs can handle the first type of error message using the key command ESC-g n and will move the main editor window to the error.
Emacs cannot handle the second error line format.
We have hacked together a workaround by wrapping the TypeScript compiler in a Perl script and got the Perl script to reformat the lines appropriately. This works but is a bit of kludge and it would be nice if TypeScript had a little more flexibility.
We were wondering if there is a flag or some way to change the Typescript error output to a format that is compatible with Emacs.
The t1.c:6:5: ... format is actually the official format documented in the GNU Coding Standards, so I think you should contact the authors of the Typescript compiler and ask them to change the format of their error messages.
In the mean time, you'll want to tweak compilation-error-regexp-alist to explain to compile.el how to recognize Typescript's error messages.
Probably something like
(eval-after-load 'compile
(add-to-list 'compilation-error-regexp-alist
'("^\\([^(\n]+\\)(\\([0-9]+\\),\\([0-9]+\\)):" 1 2 3)))
might get you started. If some of the messages are not actual errors but more like warnings or side-information, you can refine the above. See C-h v compilation-error-regexp-alist RET for details of the format.
You can also turn off the pretty mode by running something like tsc --pretty false app.ts and then emacs compile mode will start to recognize the error output.