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

tree-sitter: add org grammar #145940

Closed
wants to merge 1 commit into from
Closed

tree-sitter: add org grammar #145940

wants to merge 1 commit into from

Conversation

michaeladler
Copy link
Member

this will soon be a dependency of orgmode.nvim; currently, it is an
optional dependency.

Motivation for this change
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@teto
Copy link
Member

teto commented Nov 14, 2021

excited about this but worried that it appears as an official "org" parser while it targets neovim in the description.
maybe tree-sitter-org-nvim would leave future options more open ?

@michaeladler
Copy link
Member Author

@teto That's a good idea and I agree with you. However, when I tried it, I get an error in nvim that the 'org' parser could not be found. I don't know why and it seems strange because my understanding is that calling the parser org-nvim is purely a NixOS-thing (i.e. it boils down to a directory name and does not affect the generated parser).

@teto
Copy link
Member

teto commented Nov 15, 2021

nvim-treesitter/nvim expects a parser with the filetype as name IIRC so you may need to check the installed shared library has the correct name.
maybe check pkgs/development/tools/parsing/tree-sitter/default.nix location = if grammar ? location then grammar.location else null; ?

@michaeladler
Copy link
Member Author

nvim-treesitter/nvim expects a parser with the filetype as name

Yes, that's it. I was just confused because the output of the tree-sitter grammar is a file called parser (which is actually a shared lib). That file is then symlinked into nvim-treesitters directory and the filename of the symlink is used to register the parser under the appropriate name.

Now this leaves us at the same problem as before: let's say someone comes up with another org parser and we'd like to use it in neovim as well. If we want to make orgmode.nvim work, we have to call the orgmode.nvim parser org.so, so that name has already been taken and we cannot use it for our hypothetical org parser.

So I think if we want to use a different name for the org nvim parser, we either have to rename it upstream or patch orgmode.nvim. What do you think? Am I missing something?

@teto
Copy link
Member

teto commented Nov 16, 2021

Conflicitng filenames can be solved in nix by setting priorities (look for lowPrio) for instance. So that's a non-issue. I mean even if you were not using nix, one would have to choose wich parser to use for org.

This will soon be a dependency of orgmode.nvim. Currently, it is an
optional dependency.
@michaeladler
Copy link
Member Author

Alright, I think I have found a working solution, see my latest update.

@asymmetric
Copy link
Contributor

Closed by #154350?

@asymmetric
Copy link
Contributor

I'm going to close this as fixed by the above, feel free to reopen.

@asymmetric asymmetric closed this Jan 21, 2022
teto added a commit to teto/nixpkgs that referenced this pull request Jan 29, 2022
There are likely to be several "org" grammars so suffixing them seems
better in the long term see NixOS#145940

I haven't provided an alias since this grammar was introduced a few days
ago only.
teto added a commit that referenced this pull request Feb 1, 2022
There are likely to be several "org" grammars so suffixing them seems
better in the long term see #145940

I haven't provided an alias since this grammar was introduced a few days
ago only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants