RebelFist
RebelFist

Reputation: 559

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?

Upvotes: 6

Views: 6655

Answers (1)

Wosi
Wosi

Reputation: 45391

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.

Upvotes: 9

Related Questions