jparise / vim-graphql

A Vim plugin that provides GraphQL file detection, syntax highlighting, and indentation.
MIT License
492 stars 25 forks source link

Indention broken when used with Treesitter #67

Closed sQVe closed 4 years ago

sQVe commented 4 years ago

Hey :wave:,

I just started using https://github.com/nvim-treesitter/nvim-treesitter, a increasingly popular treesitter based highlighting plugin, and noted that the indention was broken on javascript files. I tracked this down to vim-polyglot and further down to vim-graphql.

If you run nvim-treesitter as your highlighter, with the following config:

" Treesitter.
lua <<EOF
require'nvim-treesitter.configs'.setup {
  highlight = { enable = true },
  indent = { enable = true },
}
EOF

and also have vim-graphql installed - the indention will be broken for javascript files.

Please let me know if I can provide any further information! :pray:

Vim Version

NVIM v0.5.0-808-gee3acef38
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/builds/neovim-git/src/build/config -I/tmp/builds/neovim-git/src/neovim-git/src -I/usr/include -I/tmp/builds/neovim-git/src/build/src/nvim/auto -I/tmp/builds/neovim-git/src/build/include
Compiled by sqve@jiji

Features: +acl +iconv +tui
jparise commented 4 years ago

That isn't a configuration I currently use, so it may take me a while to investigate the root cause of the issue.

If you're able to dig in and narrow down how that runtime environment differs from vim/non-treesitter, it will help me address this sooner.

sQVe commented 4 years ago

If you're able to dig in and narrow down how that runtime environment differs from vim/non-treesitter, it will help me address this sooner.

Could you elaborate a bit here? I'm a bit unsure on what you would find helpful.

jparise commented 4 years ago

Well, same. 😉 I don't use neovim or tree-sitter, so I'm not sure how they handle indentation, etc. differently from a standard vim runtime.

It'll take me some time to learn about that. If you could get a sense why this plugin is breaking in that environment, it would speed up the fix.

In the meantime, I believe there's a way to disable just the vim-graphql plugin inside of vim-polyglot. It would be helpful to know that doing so solves the problem you're seeing.

sQVe commented 4 years ago

Alright, so, as far as I know vim and neovim does not differ much in how they handle indention. But I'm far from an expert so just my $0.002 USD.

The plugin nvim-treesitter is essentially a highlighter that uses treesitter instead of regex to highlight code. I have enabled it to also handle indent but it made no difference in turning it off.

Turning graphql off in vim-polyglot does indeed solve the issue, as I noted in the first post. See https://github.com/sQVe/dotfiles/blob/master/config/nvim/plugins.vim#L12.

jparise commented 4 years ago

@sQVe I think #70 may fix the issue you're seeing. I don't think the problem was directly related to treesitter.

sQVe commented 4 years ago

@jparise Yes, you are correct. I don't see any issues any longer! :+1: :tada:

sQVe commented 4 years ago

What's the work-flow to get this pushed to vim-polyglot?

jparise commented 4 years ago

What's the work-flow to get this pushed to vim-polyglot?

I don't use vim-polyglot myself, but from the project's readme:

You can either wait for new patch release with updates or run make by yourself.

@sheerun FYI this is an important fix to pick up.

sheerun commented 4 years ago

I'll update soon, I'm on mobile internet...

On Thu, Nov 12, 2020 at 6:18 PM Jon Parise notifications@github.com wrote:

What's the work-flow to get this pushed to vim-polyglot?

I don't use vim-polyglot myself, but from the project's readme https://github.com/sheerun/vim-polyglot#updating:

You can either wait for new patch release with updates or run make by yourself.

@sheerun https://github.com/sheerun FYI this is an important fix to pick up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jparise/vim-graphql/issues/67#issuecomment-726216992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACHMDJ7HT4BLQ2Y7CRKW3LSPQKFDANCNFSM4TQX3AYQ .