gleam-lang / gleam-mode Goto Github PK
View Code? Open in Web Editor NEW🐙 Gleam support for Emacs
License: Apache License 2.0
🐙 Gleam support for Emacs
License: Apache License 2.0
Aside: This is most likely going to just be a note to myself.
Emacs 29 introduces first-party support for tree-sitter, so we'd no longer have to rely on a third-party package to provide syntax highlighting. We should transition to this new system when possible.
I have just installed gleam-mode followed the instruction, and it loads fine (gleam tree-sitter company)
when I open a .gleam
file but there is no syntax highlighting. Not sure how to fix this nor to give more debug info.
Hello, it looks like using @internal
is not currently supported. The most obvious effect of this is syntax highlighting breaking from the attribute forward:
One Interesting observation is that if I add parenthesis to the attribute, it works fine, but this is wrong and gleam fails to compile:
I am not sure if this might be an issue for tree-sitter, please let me know if that's the case.
I did check the tree and (attribute @ name: (identifier))
is recognised by tree-sitter, which seems correct to me, though I know little about ts:
Edit to add info:
Gday,
It looks as though the gitsubmodule for treesitter could do with an update. The current git submodule points to a version of treesitter that doesn't support let assert, messing with the synax with new gleam 0.27.
I hope that made sense. In the mean time, if anyone is having a problem with emacs syntax highlighting since the "let assert" change, you can:
Remove the git module
rm -rf tree-sitter-gleam
Then check out the new tree sitter
git clone https://github.com/gleam-lang/tree-sitter-gleam.git
It may require building.
cargo build
You probably need to restart emacs after. This seemed to fix it for me.
I've set up gleam with vscode, so it works fine there.
But I wanted to try gleam with Emacs and got this error:
git clone --recurse-submodules [email protected]:gleam-lang/gleam-mode
Cloning into 'gleam-mode'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Any idea why this happens?
One possible workaround would be to fork the repo.
Would you want help publishing the code to MELPA?
Im new to emacs/gleam, but I'd be happy to help.
Hey there! I'm getting very close to being satisfied with my rewrite! 🎉
I noticed that the main branch over here is named "master". The convention for Gleam repositories seems to be to use the name "main" for the main branch. Should we rename the branch to follow that convention?
The current tree sitter grammar is for gleam version 0.27.0, making the mode nearly unusable when working with gleam 1.0.0.
Steps to preproduce:
let n = 3
comment-line
: the line gets commented out: // let n = 3
uncomment-region
Current behavior: nothing happens
Expected: the line gets back to being uncommented: let n = 3
Hi, not sure how difficult this would be but installing & upgrading would be much nicer if gleam-mode was available on MELPA
Full disclosure: I am not an IP lawyer.
I just noticed that this repository does not have a license. As such, each contribution is licensed as "all rights reserved" to its author. This is a somewhat awkward position.
For inclusion in MELPA, the preeminent Emacs lisp package archive, this project would need to be licensed under something GPLv3 compatible, of which there are several options. Apache V2, the license used by Gleam, Erlang/OTP, etc is a viable option, though most Emacs packages are licensed GPLv2 or GPLv3 by convention. I'm not exactly sure what the implications of licensing this project as, say, Apache V2 and also pulling in GPL'd dependencies either (which it admittedly does not do yet).
In any event, in the course of research into this, I've found the suggestion that in order to create a new, licensed release containing the existing contributions, we (the authors and contributors) would need to provide written permission for the license change:
There are two main ways that open source projects handle this scenario:
Some projects include a “contributor licensing agreement” (CLA) ... Others simply consider every contributor to be a copyright owner. This is the default method that applies to most projects without an explicit CLA like Google’s.
The only downside of this method is if the primary or original author decides to change the license in the future. In this case, they must collect written permission from every single contributor.
Once a license is agreed upon, we (the contributors) could choose to delegate copyright to a single individual (e.g. Copyright © 2021 Louis Pilfold
), or distribute the copyright among the contributors (e.g. Copyright © 2021 gleam-mode's authors and contributors
). Either is fine, but should we want to "change" the license for future releases, the former copyright would allow Louis to choose any license whereas the latter would require that the new license be compatible with the old or we'd have to do the collecting permission rigamarole all over again.
If anyone is or knows an IP lawyer, it might be worth chiming in 😁 Sorry to be the bearer of headache-laden news!
I followed the instructions for installing gleam-ts-mode
by cloning the repository to ~/.config/emacs/modules/lang/
, adding the (use-package 'gleam-ts-mode ...)
snippet to my ~/doom.d/packages.el
, and reloading that file. When I went to run M-x: gleam-ts-install-grammar
, I got the following error:
⛔ Warning (treesit): The installed language grammar for gleam cannot be located or has problems (not-found): (libtree-sitter-gleam.so libtree-sitter-gleam.so.0 libtree-sitter-gleam.so.0.0 libtree-sitter-gleam.dylib libtree-sitter-gleam.dylib.0 libtree-sitter-gleam.dylib.0.0) No such file or directory
Any suggestions?
I'm on Emacs GNU Emacs 29.0.60 (and Doom Emacs config package)
I can't seem to get commenting work, that is, when I
// some comment
//
is addedI have all these gleam settings working:
;; Comment settings
(setq-local comment-start "// ")
(setq-local comment-end "")
(setq-local comment-start-skip "//+ *")
(setq-local comment-use-syntax t)
(setq-local comment-auto-fill-only-comments t)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.