Giter VIP home page Giter VIP logo

vscode-gleam's Introduction

โœจ VS Code Gleam โœจ

Visual Studio Marketplace Version

Provides syntax highlighting and use of the Gleam Language Server, which itself provides formatting, goto-definition, autocompletion, and more!

Hacking on the extension

Run npm run compile-watch in a terminal and hit F5 in vscode.

Contribute to the extension on Github

vscode-gleam's People

Contributors

acepie avatar aephn avatar benjamin-thomas avatar cijiugechu avatar darenc avatar dependabot[bot] avatar dizeeee avatar hamirmahal avatar jechol avatar lpil avatar manueljlin avatar maxdeviant avatar oliverevans96 avatar quinnwilton avatar rawburt avatar rinsuki avatar ta5een avatar tomjschuster avatar tomwhatmore avatar trag1c avatar varnerac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vscode-gleam's Issues

Add vsce script

I want build it to vsix so that I can install it from local.

I think it's a good idea to add a npm script for packaging like this:

  "scripts": {
    "vscode:prepublish": "webpack --mode production",
    "compile": "webpack --mode development",
    "compile-watch": "webpack --mode development --watch",
    "test-compile": "tsc -p ./",
    "vscode:package": "vsce package"
  },

"devDependencies": {
    // ...other 
    "vsce": "^2.6.7",
    // ...other
  },

Support the `use` keyword

I'm getting the following error when trying out the new use syntax in VSCode:

Syntax error

This operator has no value on its right side.

Hint: Remove it or put a value after it.

I'm running v2.0.0 of the extension.

[WIN10] [WSL] Gleam Language Server client: couldn't create connection to server.

Windows 10 Home - 22H2
WSL 2 - Debian

I installed Gleam in both the Linux and Windows systems.

For Linux, I installed it via Homebrew (4.2.17) and added /home/linuxbrew/.linuxbrew/bin/gleam to the $PATH
For Windows, I installed it via Scoop(0.3.1) and added C:\Users\askme\scoop\apps\gleam\current to the Path

I can confirm via the Debian and Powershell terminal that Gleam is functioning and that I can run my project from both terminals.
image
image

Is there something I missed, I only installed Gleam into Windows 10 as I assumed VSCode would be using that and it didn't make a difference. Any help would be appreciated.

Language Server: Couldn't create connection to server

The language server does not work for my installation. Gleam 1.0 was installed via asdf, as described in the gleam docs.

Gleam Language Server VSCode output:

[Error - 11:04:37 AM] Gleam Language Server client: couldn't create connection to server.
Launching server using command gleam failed. Error: spawn gleam ENOENT

Continue comment when pressing "Enter" within a comment

Something nice that VS Code does when working with Rust code is continuing the current comment when you press Enter while in the comment.

For example, if we had the following code with our cursor at the end of the /// This is a commnent line:

/// This is a comment
fn example() {}

Pressing Enter would result in the comment being extended to the next line:

/// This is a comment
/// 
fn example() {}

From a bit of exploration it seems like we need to do something like this within the extension: https://github.com/rust-lang/rust-analyzer/blob/bc8295255c5bcc293251d47590dcbfd320eaab87/editors/code/src/config.ts#L119-L165

Make the gleam executable file/path configurable.

Due to how my environment is set up, the gleam executable is not in $PATH when the gleam extension is loaded, and thus it can not start the language server.
(Path is set in .bashrc which is apparently not loaded)

I think the simplest and/or most general solution would be to add a setting where you can manually specify the path to the gleam executable.

contrast/background

Hi! Having a blast using the theme, albeit in short bursts -- is there any way you could and would be willing to provide a variant with a lighter, more grayish background akin to Nord or sth? The high contrast is unfortunately killing my eyes :)

VSCode: Gleam Language Server couldn't create connection to server

[Error - 16:36:48] Gleam Language Server client: couldn't create connection to server.
Launching server using command gleam failed. Error: spawn gleam ENOENT

gleam 1.0.0 installed via Homebrew

The server seems to run ok when starting via cli. Am I missing a vscode setting? Is there any way I can debug what it can't find?

Unused recursive function not highlighted as being unused.

vscode_gleam_ext_error
unused_non_recursive_func() is highlighted by vs code since it is unused, but unused_recursive_func(flag: Bool) is not highlighted since it is used within itself, which convinces vscode that it is being used. I think this is wrong and that unused_recursive_func(flag: Bool) should be marked as unused.


The same situation but in rust and using the rust-analyzer extension:
rust_unused_rec_func

Couldn't create connection to server.

This is all the detail it provided in the output.
image

I have installed gleam and all the necessary dependencies by following the docs and verified the installation too. If you need further detail then just ask.

Add command to restart Gleam language server

Some other VS Code extensions (e.g., rust-analyzer) have a command to restart the language server:

image

This can be useful in situations where the language server has gotten out of date somehow and needs a little kick to start working again.

It's currently possible to do this by using the Developer: Reload Window command, but it would be nice to have a dedicated command for restarting just the language service.

Discord discussion

License?

Gleam uses Apache 2.0, but I don't see a license here. Should we use the same one?

Poor LSP or misconfiguration?

Hi,

First of all, Gleam is AWESOME and I'm super keen to play with it.

But..
I've installed Gleam following the documentation.
image
image

But the LSP doesn't seen to be helping much.

I got code sample from the repo and I was trying to explore the LSP but no luck.
image
image

I wonder if I'm still missing something, or this is what I should expect from the current LSP?

error: Found argument 'lsp' which wasn't expected

When I run this addon I get an error in the extensions output stating:

[Error - 4:40:49 PM] Connection to server is erroring. Shutting down server.
error: Found argument 'lsp' which wasn't expected, or isn't valid in this context

USAGE:
    gleam <SUBCOMMAND>

For more information try --help

So maybe it's trying to run some kind old version of gleam that doesn't have the language server command available?

When I just run gleam lsp on the terminal it works just fine.

LSP: Hexadecimal and Binary literals don't get highlighted if used with underscore

Using gleam v1.0.0, with VSCode. Wasn't sure whether to put it here or in the extension repo, so I just put it here.

image

let _ = 123
let _ = 1_232_312
let _ = 0xFF
let _ = 0xFF_FF
let _ = 0b101101
let _ = 0b101_101

This compiles and runs just fine as expected, but the LSP doesn't seem to recognize the hex and binary with underscores as numeric literals and won't highlight them.

Note that unlike regular numbers, I don't want for these to be automatically formatted (the way normal integers are), as there's no clear way of determining where the separation is supposed to be. I'm currently using these underscores extensively in bitarrays to improve readability of magic bytes in file formats. This issue is just about the highlighting.

disable or config formatting patterns

hello,
i recently installed this extension along with the gleam language itself. I would like to know how to disable the default formatting command on save, or at least, configure it to use 4 spaces as indentation and do not put a empty newline on the end of the file.
the command npm run compile-watch returns the fallowing error:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path [...]/gleam/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '[...]/gleam/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mmd/.npm/_logs/2022-09-08T21_27_12_314Z-debug-0.log

any help would be great

Inconsistent syntax highlighting for GitHub and VSCode

My understanding is that this repo also powers the syntax highlighting for GitHub since github-linguist/linguist points here.

Lots of files in gleam-lang/stdlib do not highlight properly on GitHub (example, example, example). Here's a small demo:

import gleam/result
import gleam/int
import gleam/list
import gleam/map.{type Map}
import gleam/option.{type Option, None, Some}
import gleam/order

// Internal private representation of an Iterator
type Action(element) {
  // Dedicated to Electric Six
  // https://youtu.be/_30t2dzEgiw?t=162
  Stop
  Continue(element, fn() -> Action(element))
}

/// Traverse an iterator, calling a function on each element.
///
/// ```gleam
/// > from_list(["Tom", "Malory", "Louis"]) |> each(io.println)
/// // -> Tom
/// // -> Malory
/// // -> Louis
/// Nil
/// ```
///

pub fn yield(element: a, next: fn() -> Iterator(a)) -> Iterator(a) {
  Iterator(fn() { Continue(element, next().continuation) })
}

In every example, the issue seems to be related to the import a/b.{type c} syntax.

A similar (though less severe) issue for the Dart language seems related. It's unclear if this is a bug in this repo, in GitHub's highlighting, or in VSCode's highlighting.

LSP with Mix Gleam seems to not working

First of all, I think Gleam and its ecosystem have potential.
Wonderful work!

I tried to use VSCode Gleam with a mix_gleam project.
It looks like type inferences and real-time syntax error checking are not working.
However, the gleam compilation with mix is ok.

Thank you.

v1.3.0?

Hello!

Just noticed that the VSCode Marketplace says that the latest version is v1.3.0, but I only see v1.2.0 here. Which is correct?

Thanks,
Oliver

Roadmap?

I gave Gleam a shot, and I love the language itself and the overall vibe around it. I found the LSP lacking, but that was to be expected, and I'm looking forward to seeing this develop.

Is there a roadmap someplace to see what's planned for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.