nickel icon indicating copy to clipboard operation
nickel copied to clipboard

Optional language annotation for multiline strings

Open stelcodes opened this issue 1 year ago • 12 comments

Is your feature request related to a problem? Please describe. Within Nix code, there is often large chunks of text consisting of embedded code in multiline strings. These strings are very difficult to syntax highlight properly by a text editor, resulting in large blocks of code with no syntax highlighting and no possibility of other helpful editor features such as linting and autocompletion. This makes writing embedded code tedious. Text editors like Neovim can provide excellent language support for embedded code snippets when it can determine the code type (for example, fenced code blocks in Markdown documents). Having an optional language annotation for multiline strings would make editing embedded code significantly easier.

Describe the solution you'd like An optional language info string after the initial '' for multiline strings like this:

let neovim_config = ''lua
  -- Turn on incsearch
  vim.opt.incsearch = true
'';

Describe alternatives you've considered I don't think there's any other obvious way of implementing this feature.

Additional context Inspiration coming from Markdown's fenced code block's info string which allows embedded programming languages to be properly syntax highlighted.

stelcodes avatar May 20 '23 16:05 stelcodes