Comments (21)
it is impractical to expect Emacs to track all the changes in the individual repositories. E.g., tomorrow you could decide that the branch which holds the generated parser files will be called differently, and the Emacs users will be non the wiser.
It prompts the user for the URL of the repository and uses its default branch. Asking users to specify a special branch, let alone a commit SHA, would be a major inconvenience for users. I suspect most of them will not have the information available to do so.
It looks like the branch / sha can be set interactively via: treesit--install-language-grammar-build-recipe
. Emacs seems to have the ability to ask for the branch to use.
IMO the problem here isn't that emacs can't use a different branch it's that there's no good solution for emac users to know the installation instructions for each grammar they use and know when those change. Helix solves this by controlling the list themselves and neovim solves it via a community maintained plugin.
There could be space for an Emacs community plugin that maintains a list of parser installation instructions. This could be a predefined treesit-language-source-alist
that can be downloaded. I'd be happy to help keep the sql parser entry up-to-date, @matthias-Q & I already open PRs to keep the nvim-treesitter
lockfile up-to-date.
I'd also be open to including some installation instructions in the README.md
or on a project wiki with notes on how to install it for emacs.
However, I don't think enforcing a project layout for tree-sitter grammars is a good solution, there are many different grammars with different maintainers and use cases. For example, this grammar for markdown MDeiml/tree-sitter-markdown
defines two complementary parsers that are meant to be used together. I'd also like to note that this subdirectory pattern is also supported by treesit--install-language-grammar-build-recipe
.
While I agree that it is inconvenient for parsers to diverge from the "standard" project layout, we do provide an alternative that's compatible with the existing tools provided by emacs.
from tree-sitter-sql.
We moved the generated files to another branch gh-pages
can you configure specify a git commit hash (like helix) or a specific branch (like nvim-treesitter) to fetch the source artifacts?
from tree-sitter-sql.
can you configure specify a git commit hash (like helix) or a specific branch (like nvim-treesitter) to fetch the source artifacts?
The Emacs command in question is not pre-configured. It prompts the user for the URL of the repository and uses its default branch. Asking users to specify a special branch, let alone a commit SHA, would be a major inconvenience for users. I suspect most of them will not have the information available to do so.
So this is technically possible, but not really practical, from the Emacs users POV.
from tree-sitter-sql.
Ok, I understand. I was checking out the emacs code and I saw the option on one subfunction to specify a revision.
The reason we moved the artifacts into another branch was because these are autogenerated files and they caused merge conflicts all the time. Hence, slowing down development.
@DerekStride whats your take on that?
from tree-sitter-sql.
The command aI was talking about is treesit-install-language-grammar
, you can find it in the file treesit.el
in the Emacs repository.
Thank you for reconsidering this issue.
from tree-sitter-sql.
Is this also an issue in neovim? my highlighting looks very off and was going to make an issue, unsure if I need the grammar files for this to work if I'm using TSInstall
from tree-sitter-sql.
Fetching the source artifacts is not an issue in neovim.
Highlighting is done in nvim-treesitter. May I ask what your issue is @igniscyan ? I have recently commited an overhaul of the highlight queries in nvim-treesitter. So there have been some changes and I definitely looks different now.
from tree-sitter-sql.
@Eli-Zaretskii this function references a treesit-language-source-alist
Looks like a revision can be specified there. I was not able to find this in the repo.
from tree-sitter-sql.
Fetching the source artifacts is not an issue in neovim.
Highlighting is done in nvim-treesitter. May I ask what your issue is @igniscyan ? I have recently commited an overhaul of the highlight queries in nvim-treesitter. So there have been some changes and I definitely looks different now.
Sure! I just switched to nvim so not 100% sure if there's something going wrong on my end, but healthcheck makes it look as though everything is fine.
The above is a screen of the highlighting in VSCode, which looks correct.
And this is the same block being highlighted with nvim-treesitter.
Edit: for context, this is just a large insert statement.
from tree-sitter-sql.
@igniscyan I have recreated two lines on my machine and the MG on 400MG is parsed as a string and the percentage on '5%' as well.
Maybe you have some other plugin the overrides highlight groups or does injection of units.
from tree-sitter-sql.
@igniscyan I have recreated two lines on my machine and the MG on 400MG is parsed as a string and the percentage on '5%' as well.
Maybe you have some other plugin the overrides highlight groups or does injection of units.
Noticing I have a lot of errors towards the beginning of the file as well:
Any idea what's causing this/how to go about debugging this?
from tree-sitter-sql.
It is getting off topic now. The issue is that we are currently not parsing the CURRENT_TIMESTAMP
function. I will create an issue and see what I can do.
from tree-sitter-sql.
@Eli-Zaretskii this function references a treesit-language-source-alist Looks like a revision can be specified there.
The list in treesit-language-source-alist
starts empty and is populated as the user installs the grammars he/she needs, as side effect of the installation.
And even if that list was populated OOTB, it is impractical to expect Emacs to track all the changes in the individual repositories. E.g., tomorrow you could decide that the branch which holds the generated parser files will be called differently, and the Emacs users will be non the wiser. By contrast, the default branch always exists and is always kept in good shape.
from tree-sitter-sql.
This is actually exactly how neovim and helix are tracking different parsers (by commit hash). By just looking at the default branch you are also not safe with regards to breaking changes.
from tree-sitter-sql.
This is actually exactly how neovim and helix are tracking different parsers (by commit hash).
I'm not familiar with how and at what regularity is neovim released, but with Emacs release schedule of roughly 2 years between major releases and 6 months between minor bug-fix releases, it is practically impossible to keep the list up-to-date if it must track individual commits. We don't populate the list of the repositories of the grammar libraries with specific URLs for that very reason: we don't want to have to keep the list up-to-date at all times, and with our release schedule we won't be able to anyway.
By just looking at the default branch you are also not safe with regards to breaking changes.
We would ideally try to use official releases, which would be a much more dependable and stable target, but unfortunately many tree-sitter grammar libraries don't make official releases, and that includes tree-sitter-sql, AFAICT.
from tree-sitter-sql.
The grammars are not part of neovim, just the capabilities of using tree-sitter as a parser. the grammars themself are added by a plugin called nvim-treesitter
and this uses a lockfile.
For helix, the lockfile is part of the repository and the grammar version are then used while building the binary.
from tree-sitter-sql.
With Emacs, the grammars aren't part of the the package, either. Users are supposed to install the grammar libraries themselves, using the commands, tools, and directories appropriate to their platforms. The difference, AFAIU, is that the Emacs command that downloads, builds, and installs a grammar library is not a separate plugin, and is therefore released and updated together with Emacs.
from tree-sitter-sql.
Yes, that is exactly how nvim-treesitter and helix are loading the grammars.
from tree-sitter-sql.
My two cents: I switched to this treesitter grammar because https://github.com/m-novikov/tree-sitter-sql removed the autogenerated parser.c
from their repo. The gh-pages
branch might be sufficient to prevent breakage but I haven't tested it yet
from tree-sitter-sql.
IMO the problem here isn't that emacs can't use a different branch it's that there's no good solution for emac users to know the installation instructions for each grammar they use and know when those change.
Exactly. This Emacs command is supposed to help users who know little about Git repositories, let alone about the branches of each one of them.
from tree-sitter-sql.
Exactly. This Emacs command is supposed to help users who know little about Git repositories, let alone about the branches of each one of them.
It seems we agree on the problem and I've provided sufficient reasoning that the problem lies outside of the structure of this project and instead is a result of a gap in the emacs ecosystem.
I've opened a PR #124 to update the README with installation instructions on how to compile the parser, and where to find & download the parser files. I'd appreciate feedback on the PR.
from tree-sitter-sql.
Related Issues (20)
- Array dereference not supported
- Field expression not supported
- Additional dollar quote support HOT 2
- Highlighting queries rely on neovim-only `lua-match` HOT 4
- segfault HOT 16
- Scanner.c is missing on npm, therefore preventing the package installation HOT 3
- Include parser files in Release Assets HOT 5
- Syntax highlighting appears to give up in Postgres function bodies HOT 1
- Syntax highlighting breaks when using $ in VALUES HOT 4
- Invalid node type "keyword_without" on nightly HOT 2
- Cargo.toml missing on gh-pages branch HOT 3
- Trailing Comma - Snowflake HOT 4
- IGNORE NULLS breaks window function parsing HOT 1
- Support for check constraints HOT 1
- UNIQUE constraint not parsed correctly
- Cannot run in a macOS environment
- Support for COPY FROM STDIN HOT 10
- specific statement after a specific pg alter table is not parsed correctly HOT 4
- Improve partial query handling HOT 2
- Add backslashed single quotes to grammar HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-sql.