Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add keywords (syntax highlighting) to language extension?

Does anyone know of a way to add new keywords (for syntax highlighting) to a language extension from the marketplace? Specifically I'm using the PL/SQL extension but it's missing some keywords I'd like to add (like BETWEEN, GREATEST, LEAST) without recreating the whole language extension myself. It was pretty easy to associate new file extensions with it but I haven't been able to find any documentation on adding keywords like you can in Notepad++ for example.

Is there documentation somewhere I missed?

like image 399
RebelFist Avatar asked Oct 21 '16 11:10

RebelFist


People also ask

How do you add keywords in VS Code?

To customize the keywords and other stuff, command + , (Windows / Linux: File -> Preferences -> User Settings) open the vscode file settings. json . Toggle the highlight, default is true. Whether the keywords are case sensitive or not.

How do I turn on syntax highlighting?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

How do I enable syntax highlighting in Notepad ++?

To configure syntax highlighting, click on “Language” in the top bar, then click the letter the language starts with, and then the language. If you want to define your own language, click on “Language” again, then click on “User Defined Language”, third from the bottom, and then click “Define your language”.


1 Answers

Add the keywords to the language's syntax file

  • Open the extension's folder

    • Windows: %USERPROFILE%\.vscode\extensions\casian.plsql-0.0.2
    • Mac/Linux: $HOME/.vscode/extensions/casian.plsql-0.0.2
  • Open the .tmLanguage file

  • Go to the line which contains the highlighted keywords such as select and from.
  • Add the missing keywords to the list and save the file
  • Reload VSCode. Now the recently added keywords appear highlighted
  • Backup the .tmLanguage file. Your changes will be overwritten when there is an update for the plugin.
like image 194
Wosi Avatar answered Oct 12 '22 15:10

Wosi