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

Syntax highlighting support for various languages (tree-sitter grammars list) #272

Open
44 of 60 tasks
Tiggilyboo opened this issue Mar 25, 2022 · 65 comments · Fixed by #656
Open
44 of 60 tasks

Syntax highlighting support for various languages (tree-sitter grammars list) #272

Tiggilyboo opened this issue Mar 25, 2022 · 65 comments · Fixed by #656
Labels
A-editor Area: editor, modal editing C-feature Category: New feature or request good first issue Good for newcomers

Comments

@Tiggilyboo
Copy link

Tiggilyboo commented Mar 25, 2022

Having looked through the majority of the issues, I would like to collectively address the state of the tree sitter language support currently in Lapce.

Here follows current support:

I would like to get a few more of these up and running, I'll see what others remain which are more low hanging fruit (Already on version 0.20 of tree-sitter and already expose the highlight query).

One other thing I would like to address is whether or not we wish to put a feature flag on these? Not sure how large all of these + build time impact this would have for lapce. Something to think about...

Cheers, I am really enjoying this editor!

This was referenced Mar 25, 2022
@bugadani

This comment was marked as resolved.

@bugadani
Copy link
Contributor

Looking at how slowly a simple version change goes through in the upstream grammar repos, I wonder if we should temporarily use the forks instead. We aren't building to publish on crates.io so git dependencies should be just fine. We can track here which packages use the upstream versions and which ones use the forks. This would allow us to add support faster, as well as fix issues without being blocked on low traffic crates.

@nanjizal

This comment was marked as resolved.

@nheuillet

This comment was marked as resolved.

@jpmc

This comment was marked as resolved.

@Erudition

This comment was marked as resolved.

@ghishadow

This comment was marked as resolved.

@VixieTSQ
Copy link
Contributor

VixieTSQ commented Jun 18, 2022

The current swift grammar linked is abandoned. Update it with this one: https://github.com/alex-pinkus/tree-sitter-swift
now waiting on this pr for upstream: alex-pinkus/tree-sitter-swift#194

@VixieTSQ
Copy link
Contributor

VixieTSQ commented Jun 18, 2022

I've just made prs to a lot of these. Here you are!

We're waiting on:
Verilog
Swift can be implemented right now! Is up to date and highlights exposed. You must use the crate on crates.io. Implemented!
SCSS
Scala
QL can be implemented right now! Is up to date and highlights exposed. Implemented!
OCaml
HCL
Haxe
Haskell can be implemented right now! Is up to date and highlights exposed. Implemented!
Glimmer
Fluent

@ghishadow
Copy link
Contributor

@VixieTSQ for HCL updated repo is https://github.com/MichaHoffmann/tree-sitter-hcl

@VixieTSQ
Copy link
Contributor

VixieTSQ commented Jun 18, 2022

@ghishadow
list updated that one doesn't have it's bindings generated. I'll send a PR. But it also doesn't have a highlights file...

@ghishadow
Copy link
Contributor

@ghishadow list updated that one doesn't have it's bindings generated. I'll send a PR. But it also doesn't have a highlights file...

you can copy from https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries/hcl or https://github.com/helix-editor/helix/tree/master/runtime/queries/hcl I think with attribution.

Looks like HTML syntax highlighting is also not working as HIGHLIGHTS_QUERY is commented in https://github.com/tree-sitter/tree-sitter-html/blob/master/bindings/rust/lib.rs#L38

@VixieTSQ
Copy link
Contributor

VixieTSQ commented Jun 18, 2022

#636 has been merged! go ahead and check those langs off, @Tiggilyboo

@bugadani
Copy link
Contributor

I've done that :)

@SimY4
Copy link

SimY4 commented May 29, 2023

Tree sitter Scala: https://github.com/tree-sitter/tree-sitter-scala

@panekj panekj changed the title Tree Sitter Language Support Syntax highlighting support for various languages (tree-sitter grammars list) Jun 2, 2023
@urbit-pilled
Copy link

Tree sitter hoon: https://github.com/urbit-pilled/tree-sitter-hoon

@baldram
Copy link

baldram commented Jul 18, 2023

Here is the Scala related PR #2280 not mentioned in the #272 (comment). It has been waiting for four months, so we'll need to resolve some minor conflicts and it's ready for another review probably then.

@panekj
Copy link
Collaborator

panekj commented Jul 18, 2023

We're not going to add any additional grammar to lapce for now until external grammar store is implemented.

@baldram
Copy link

baldram commented Jul 18, 2023

@panekj Thank you for the clarification.
Can you elaborate more what is "external grammar store" that blocks it? Which issue to track?

Is there a way to enable syntax highlighting locally, from within the editor, without adding it to lapce-core/Cargo.toml through a PR?

@panekj
Copy link
Collaborator

panekj commented Jul 18, 2023

Can you elaborate more what is "external grammar store" that blocks it?

Place to get additional grammars from, something like what plugins currently are except we can't distribute grammars through plugin store

Which issue to track?

There isn't any

Is there a way to enable syntax highlighting locally, from within the editor, without adding it to lapce-core/Cargo.toml through a PR?

No

@aryalaadi
Copy link

AT&T asm?

@JLCareglio
Copy link

I'm currently working on implementing astro - can this be added to the list?

Idem 👀

@maxpetts
Copy link

maxpetts commented Sep 4, 2023

I'm currently working on implementing astro - can this be added to the list?

Idem 👀

#1874

@FlixCoder
Copy link
Contributor

Typst:
https://github.com/uben0/tree-sitter-typst

(or https://github.com/frozolotl/tree-sitter-typst )

@lnxyz
Copy link

lnxyz commented Oct 8, 2023

tree sitter nim:
https://github.com/alaviss/tree-sitter-nim

@framlingham
Copy link

I would love to have AutoIt or AHK (v2) syntax highlighting if possible. I might have to have a look at tree-sitter.

@coolcoder613eb
Copy link

Assembler, NASM?

@volkertb
Copy link

volkertb commented Dec 31, 2023

Question: both Dockerfile and bash are checked, but in the nightly build as of 2023-12-31, neither Dockerfiles nor .sh files are getting any hightlighting. (The .sh file with which I just tried this has a #!/usr/bin/env bash shebang, so it's actually a Bash script, not just a generic POSIX shell script.)

Is there anything we need to do to get highlighting for such file types to work?

XML file highlighting also isn't working, at least not "out of the box".

C, C++ and yaml files do appear to have highlighting "out of the box".

@panekj
Copy link
Collaborator

panekj commented Dec 31, 2023

Highlighting changed due to dynamic grammar loading and some languages might be broken for now

@volkertb
Copy link

volkertb commented Dec 31, 2023

Got it. Thanks for clarifying. 👍

@volkertb
Copy link

Maybe reset the checkmarks then, to avoid confusion?

@volkertb
Copy link

volkertb commented Dec 31, 2023

Highlighting for Markdown (.md) does currently work, at least in the most recent nightly build. ☑️

@volkertb
Copy link

volkertb commented Dec 31, 2023

Highlighting for DOS/Windows batch (.bat) files currently does not work, at least in the most recent nightly build. ❌

@Hellfar
Copy link

Hellfar commented Mar 17, 2024

Highlighting for Ruby (.rb) files currently does not work, at least in the v0.3.1. ❌

@kylegoetz
Copy link

Highlighting changed due to dynamic grammar loading and some languages might be broken for now

Does this mean that we are able to externally load grammars now? I had written a TSG for Unison and was going to file a PR and that same week, it was announced that Lapce would not incorporate any more TSGs until an "external store" was available (unsure what that means, like a central Lapce-hosted repository of TSGs?), and so I bailed on Lapce as an IDE because it officially could not support my language. I stepped away from Lapce since fall of 2023 and decided to check back in.

@panekj
Copy link
Collaborator

panekj commented Apr 5, 2024

Does this mean that we are able to externally load grammars now?

Yes, but adding new languages is not possible without modifying Lapce and building it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-editor Area: editor, modal editing C-feature Category: New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.