Search code examples
visual-studio-codemodeline

Vim or Emacs-like modeline magic support for VSCode


I'm writing a script using Qt's ECMAScript. The files use the extension .qs, which VSCode does not currently have syntax highlighting for. javascript syntax highlighting, however, is plenty pretty to satisfy me.

Is there any way to map .qs to javascript from within the .qs file? This would be similar to File Variables for Emacs or Modeline Magic for Vim.

I know that I can map .qs to javascript in the VSCode settings as described here, but would prefer something that ships with the file.

There's also this extension that seems to achieve this, but I'm curious if there are other options.

Example modelines for both Vim and Emacs:

# vim: set ft=js
// -*- mode: js; -*-

Preferably this would be built into VSCode, but it doesn't look like that is going to happen based on the answer to this issue.

Looking for other hacks or alternatives that people know of!


Solution

  • As of right now I can't find any support for modelines natively in VS Code.

    You can, however, get similar functionality from a an extension like this one: https://marketplace.visualstudio.com/items?itemName=chrislajoie.vscode-modelines