Skip to content

Commit

Permalink
Version & Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maurobalbi committed Mar 13, 2024
1 parent db4b0ea commit e649b02
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Disclaimer
Glas is a pet-project of mine and expected to be eventually surpassed in scope and features by the official Gleam-LSP. Bug reports are very welcome, but for feature-requests and other contributions please refer to the official [gleam-repo](https://github.com/gleam-lang/gleam) instead.
Glas is a pet project of mine and is expected to be surpassed in terms of scope and features by the official Gleam-LSP in due time. Bug reports are much appreciated, but for feature requests and contributions please refer to the official [Gleam reposository](https://github.com/gleam-lang/gleam) instead.

# glas: Gleam Language Server

Expand All @@ -13,35 +13,41 @@ Currently MacOS (arm64, x86), Linux (x86), Windows (x86) are supported. Other ta

Install the extension from [VisualStudio Marketplace](https://marketplace.visualstudio.com/items?itemName=maurobalbi.glas-vscode). Binaries are included in the extension archive.

### NeoVim lspconfig
### NeoVim

```lua
require'lspconfig'.gleam.setup{
cmd = { "glas", "--stdio" }
}
```

### Others

For other platforms binaries have to be built from source.

## Features

- Resilient parsing
- Resilient Parsing and Type Checking
- Completions
- Goto-Definition
- References
- Highlight-Related
- Hover-Info
- Syntax-Errors
- Semantic highlighting
- Show syntax-tree
- Goto Definition
- Find References
- Highlight Related
- Hover Info
- Syntax Errors
- Semantic Highlighting
- Show Syntax Tree
- Rename

### Motivation?

This project was primarily motivated by my personal learning about how language servers, in general, and rust-analyzer, in particular, work. Gleam caught my interest due to it's lovely and active community and the interesting niche (functional, statically typed, simple) it's trying to fill.

### Goals
- Personal Learning
- Good UX
- Provide only correct refactorings (if it compiles before it compiles after)
- Robustness

### Non goals
- Aiming for 100% diagnostics (at least short / midterm)
- Code generation

### Architecture

Since the code in an actual file during development is usually in a `broken` state, having a specialized IDE architecture helps making sense of the code on a best-effort basis.
Expand All @@ -50,16 +56,6 @@ In a broad sense, the architecture of glas can be thought of as going from chain

Where this is particularly evident is in the parser. Instead of aborting at the first error, the parser always produces a concrete syntax tree and collects errors as it goes. [This blog post by matklad](https://matklad.github.io/2023/05/21/resilient-ll-parsing-tutorial.html) provides an excellent explanation of this concept, and the parser in this project is based on the ideas presented there. To visualize the syntax tree of a file, the VSCode extension implements the "show syntax tree" command, allowing you to explore the tree as you type.

### Goals
- Learning
- Good UX
- Provide only correct refactorings (if it compiles before it should compile after)
- Emphasize resilience

### Non goals
- Aiming for 100% diagnostics (at least short / midterm)
- Code generation

## Acknowledgments

This project is heavily inspired by the exellent [Nix language server](https://github.com/oxalica/nil) and [rust-analyzer](https://github.com/rust-lang/rust-analyzer).
4 changes: 2 additions & 2 deletions crates/glas/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ impl Server {
self.opened_files.insert(uri.clone(), FileData::default());
self.set_vfs_file_content(&uri, params.text_document.text.clone());

match *self.gleam_interop_client.lock().unwrap() {
let _ = match *self.gleam_interop_client.lock().unwrap() {
Some(ref mut client) => client.did_open(params),
None => Ok(()),
};
Expand Down Expand Up @@ -521,7 +521,7 @@ impl Server {

fn on_did_save(&mut self, params: DidSaveTextDocumentParams) -> NotifyResult {
tracing::info!("Received save notification");
match *self.gleam_interop_client.lock().unwrap() {
let _ = match *self.gleam_interop_client.lock().unwrap() {
Some(ref mut client) => client.did_save(params),
None => Ok(()),
};
Expand Down
1 change: 1 addition & 0 deletions editor/code/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Support for module constants
- Hover-documentation for qualified definitions
- Don't show private definitions in completions
- Add Info Message if 'gleam' is not in PATH

## v0.1.9

Expand Down
16 changes: 8 additions & 8 deletions editor/code/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Disclaimer
Glas is a pet-project of mine and expected to be eventually surpassed in terms of scope and features by the official Gleam-LSP. Bug reports are very welcome, but for feature-requests and other contributions please refer to the official [gleam-repo](https://github.com/gleam-lang/gleam) instead.
Glas is a pet project of mine and is expected to be surpassed in terms of scope and features by the official Gleam-LSP in due time. Bug reports are much appreciated, but for feature requests and contributions please refer to the official [Gleam reposository](https://github.com/gleam-lang/gleam) instead.

# glas: Gleam Language Server

Expand All @@ -11,15 +11,15 @@ Install the extension from [VisualStudio Marketplace](https://marketplace.visual

## Features

- Resilient parsing
- Resilient Parsing and Type Checking
- Completions
- Goto-Definition
- Goto Definition
- Find References
- Highlight-Related
- Hover-Info
- Syntax-Errors
- Semantic highlighting
- Show syntax-tree
- Highlight Related
- Hover Info
- Syntax Errors
- Semantic Highlighting
- Show Syntax Tree
- Rename

![](https://raw.githubusercontent.com/maurobalbi/glas/main/editor/code/images/renaming.gif)
Expand Down
2 changes: 1 addition & 1 deletion editor/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "glas: Gleam Language Server",
"description": "Gleam language server for VSCode",
"repository": "https://github.com/maurobalbi/glas",
"version": "0.1.9",
"version": "0.2.0",
"icon": "images/icon.png",
"publisher": "maurobalbi",
"engines": {
Expand Down

0 comments on commit e649b02

Please sign in to comment.