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

fix(gotmpl): cleanup tree-sitter #507

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 5 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1176,39 +1176,20 @@ local cfg = require'go.lsp'.config() -- config() return the go.nvim gopls setup
require('lspconfig').gopls.setup(cfg)
```

## Highlighting for gomod, gosum, gohtmltmpl, gotmpl, gotexttmpl
## Highlighting for gomod, gosum, gohtmltmpl, gotmpl

You can install treesitter parser for gomod and gosum
You can install tree-sitter parsers for gomod, gosum and gotmpl

```vim
:TSInstall gomod gosum
```

As for go template, the plugin has not been merge to treeistter master yet, you need to install
[treesitter-go-template](https://github.com/ngalaiko/tree-sitter-go-template)

```lua
local parser_config = require'nvim-treesitter.parsers'.get_parser_configs()
parser_config.gotmpl = {
install_info = {
url = "https://github.com/ngalaiko/tree-sitter-go-template",
files = {"src/parser.c"}
},
filetype = "gotmpl",
used_by = {"gohtmltmpl", "gotexttmpl", "gotmpl", "yaml"}
}
```

And run

```vim
:TSInstall gotmpl
:TSInstall gomod gosum gotmpl
```

The plugin injects the tmpl to html syntax so you should see this:

![image](https://github.com/ray-x/go.nvim/assets/1681295/7d11eb96-4803-418b-b056-336163ed492b)

To get highlighting for other templated languages check out the docs of [tree-sitter-go-template](https://github.com/ngalaiko/tree-sitter-go-template).

## Integrate null-ls

### The plugin provides:
Expand Down
85 changes: 0 additions & 85 deletions queries/gotmpl/highlights.scm

This file was deleted.

2 changes: 0 additions & 2 deletions queries/gotmpl/injections.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(text) @yaml

((text) @injection.content
(#set! injection.language "html")
(#set! injection.combined))
Expand Down
Loading