-
Notifications
You must be signed in to change notification settings - Fork 42
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
Load modes from <config dir>/modes/
#68
base: master
Are you sure you want to change the base?
Conversation
In addition to loading modes from `config.ron`, load modes the `modes` subdirectory of the configuration directory. For example: $ cat ~/.config/zee/modes/markdown.ron Mode( name: "Markdown", scope: "source.md", injection_regex: "md|markdown", patterns: [ Suffix(".md"), ], comment: None, indentation: Indentation( width: 2, unit: Space, ), grammar: Some( Grammar( id: "markdown", source: Git( git: "https://github.com/MDeiml/tree-sitter-markdown", rev: "d24196f9b3e5af6fcb2ec2a0b6cbc5c06f58b85e", ), ) ), )
1327ba0
to
8bb2088
Compare
Yes, this is a very interesting feature, thank you for your enhancement! I would like to suggest to focus on the first option to outsource the mode definition to an own directory rather than providing precompiled versions since this would limit people to a fixed set of platforms. When building the modes with The provision of a precompiled mode could be a next step but should in no case replace the current download mechanism in order to prevent the problems described above. And finally, both options rely on a directory to load from, so continuing developing the directory at first appears to be a reasonable design decision to me. |
How about making the path to the |
What exactly do you mean to provide for download? I interpreted this sentence as provision of precompiled mode packs, this is the Another option, without having to precompile the parsers, is to just provide the RON files for the modes but this would still require to |
I should clarify my intent. I did not intend that binaries would be provided by the project, as you say, too much work to maintain them for all platforms. My thought was that the mode RON files (like the example markdown.ron above) could be distributed separately from the application, and the user could build them themselves. Eventually if zee binaries are provided by the project or an outside group (linux distros, packing systems for macOS/windows, etc.) they could perhaps also provide compiled tree sitter libraries but I'm not thinking of that as an immediate goal. |
The current code expects the @mcobzarenco As the project owner, what is your preference for configuration parameters? Would you like to allow for full customization but possibly more difficult to support model or a "one size fits all" model where customization is limited but that will work the same for all users? |
Yes, there is a pretty common use case in my opinion: users who would like to switch between different versions. In #57, you mentioned a mode configuration file of another editor. If you now compare the Git revision of the Haskell mode they prefer with the Git revision I suggest in #62, you will see that these are different values. I suggested the latest available version since I intended our users to be able to use all implemented features while they surely have their reasons to recommend an older version. If one now would like to test other versions of a certain Tree-Sitter, especially for updating supported modes, it is very useful to point to another directory with the newer revisions configured. Editing the |
Rather than pointing solely to a different directory for modes with the updated rev, wouldn't you need to point to a different config directory all together so that the Let's wait on Marius' vision for the application (and whether this is even a wanted feature). If everything should be configurable I can add the an item for modes and potentially the |
The |
Regarding the two options you mentioned in your first post, soft-linking versus download: they do not need to exclude each other. When combining them, there would be the option to provide the configured modes as a repository in this namespace where all suggested configurations are provided, let us assume it is named as you suggested: If the What do you think? |
Just as there is a default configuration file which is fetched when initialising from a newly installed binary, a default collection of stable mode configurations could be provided similarly in an own directory in this repository. It could become the suggested |
In addition to loading modes from
config.ron
, load modes themodes
subdirectory of the configuration directory.For example, the following would enable the
Markdown
mode:This PR is meant an exploration of the options for making mode configuration easier by removing the need to edit RON files themselves. One possible usage would be to make a
<config dir>/modes.avail/
directory containing all of the known modes that a user could then symlink to<config dir>/modes/
similar to how freetype on many linux/unix systems works. Another would be to allow users to download modes from the zee website (or a github repo) and put them into<config dir>/modes/
prior to running--build
to enable additional languages.Any interest in me polishing this feature a little more or it is preferred to keep all mode configuration in
config.ron
?