Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fenced code blocks via multiple modes #175

Open
sellout opened this issue Dec 5, 2022 · 3 comments
Open

Support fenced code blocks via multiple modes #175

sellout opened this issue Dec 5, 2022 · 3 comments

Comments

@sellout
Copy link

sellout commented Dec 5, 2022

In LnL7/vim-nix#28, there is support for highlighting code within nix lines, using inline comments before the opening '', like

{
  foo = /* sh */ ''
    mkdir -p $out/share
  '';
}

I would love to have this. The two should be compatible, as @LnL7 mentions in LnL7/vim-nix#28 (comment), so we should coördinate.

@gekoke
Copy link

gekoke commented Dec 16, 2022

I was just thinking about this - and hey, most recent issue!

It would also be cool if appropriate highlighting could be inferred for text blocks following certain functions like pkgs.writeShellScriptBin and pkgs.writePython3Bin, without requiring a comment.

@akirak
Copy link
Contributor

akirak commented Dec 16, 2022

Isn't this a job of tree-sitter? nix-community/tree-sitter-nix#31

There are mmm-mode, polymode, etc. which let you configure mixed modes, but their behaviors are sometimes a bit awkward. I have worked on TypeScript (with React JSX in it) in Emacs, and tree-sitter is the best option for highlighting mixed modes.

For editing, there is separedit support.

@matthewbauer
Copy link
Member

I have experimented with this in https://github.com/NixOS/nix-mode/blob/master/nix-mode-mmm.el, but haven't used it recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants