Giter Club home page Giter Club logo

Comments (6)

ColinKennedy avatar ColinKennedy commented on July 18, 2024 1

Looking at your Neovim version again, 0.9.5, isn't that version out of date?

0.9.5 is this release - neovim/neovim@8744ee8. And the equivalent path in Neovim is {neovim_root}/runtime/lua/vim/filetype.lua. https://github.com/neovim/neovim/blob/8744ee8783a8597f9fce4a573ae05aca2f412120/runtime/lua/vim/filetype.lua doesn't have usd filetypes yet. But it does exist in master.

Once Neovim 0.10 is released you can upgrade to that. In the meantime there's the option to compile master / nightly from source. Or you can also add au BufNewFile,BufRead *.usda,*.usd setf usd to your configuration in the meantime and then remove it once you're on a later Neovim version.

Let me know if compiling Neovim from master / nightly solves it and, if so, I can update the README.md to specify Neovim 0.10+ as a requirement if you intend to use this grammar for that editor.

from tree-sitter-usd.

teonnik avatar teonnik commented on July 18, 2024 1

0.9.5 is this release - neovim/neovim@8744ee8. And the equivalent path in Neovim is {neovim_root}/runtime/lua/vim/filetype.lua. https://github.com/neovim/neovim/blob/8744ee8783a8597f9fce4a573ae05aca2f412120/runtime/lua/vim/filetype.lua doesn't have usd filetypes yet. But it does exist in master.

Good catch, that is indeed the issue. Neovim 0.10 will be released in 1 week. I can test once it's out. The workaround works for now: au BufNewFile,BufRead *.usda,*.usd setf usd. Thanks for the help. :)

from tree-sitter-usd.

ColinKennedy avatar ColinKennedy commented on July 18, 2024

When you move your cursor over a keyword and do :Inspect what's the output? And what's the output of :InspectTree? It's possible that the grammar is fine but your configuration doesn't have set syntax enabled or something.

This is what my :InspectTree looks like

image

If :InspectTree is empty, try calling :lua vim.treesitter.start(0, "usd") on the current buffer and try :InspectTree again.

from tree-sitter-usd.

teonnik avatar teonnik commented on July 18, 2024

Calling :lua vim.treesitter.start(0, "usd") seems to make things work:

image

:InspectTree fails regardless of whether it's called before or after the start() call:

image

:Inspect works after the start() call:

image

but not before :

image

set syntax returns : syntax=conf

from tree-sitter-usd.

ColinKennedy avatar ColinKennedy commented on July 18, 2024

If I remember right, the :InspectTree loads using your filetype attribute. And filetype is detected by the name of the file extension

e.g. main.usda, on open
set filetype? = usd
set syntax? = ``

If yours prints back

set filetype? = conf or something else or ""
set syntax? = conf

Then that would explain all that we've seen so far. e.g. highlighting works but only after calling lua vim.treesitter.start(0, "usd") but :InspectTree still fails because it's reading from your set filetype? which is incorrectly set. Filetype discovery is controlled by https://github.com/vim/vim/blob/ea999037a41292b3d3e00700a87a82fe5d2c12b2/runtime/filetype.vim#L3033-L3034. And it works for .usd and .usda extensions.

What's the name of the file that you're trying to load? Can you confirm that set filetype? = usd on start-up?

from tree-sitter-usd.

teonnik avatar teonnik commented on July 18, 2024

Indeed, as you suggested, there appears to be a problem with filetype: set filetype? = conf. If I set it to usd, highlighting works and :InspectTree works.

I now wonder why files with .usda and .usd extensions are not recognized as filetype = usd in my setup? I have nothing unusual happening with filetype in my config. In fact, the only lines in my config with filetype are:

filetype indent on  " load filetype-specific indent files
filetype plugin on  " enable filetype plugins
au BufEnter *.tpp :setlocal filetype=cpp

The link to filetype.vim that you referenced is from the vim repo, I am using neovim but the docs suggest that it should be processed anyway.

from tree-sitter-usd.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.