Skip to content

Commit

Permalink
Update README to provide more detailed information
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodywasishere committed Feb 7, 2024
1 parent b94ce06 commit 32abd48
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 12 deletions.
84 changes: 72 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,83 @@
# VSCode Extension for Crystal Language

![Publish Extension](https://github.com/crystal-lang-tools/vscode-crystal-lang/workflows/Publish%20Extension/badge.svg)
---
**This is the official version of the plugin for Crystal Language support in VS Code.**
**Remove all old versions before installing this one.**
---

This extension provides support for the [Crystal](https://github.com/crystal-lang) programming language.

![vscode-crystal-lang](https://i.imgur.com/ZxIsOWB.gif)
![vscode-crystal-lang](./images/vscode-example.gif)

## Wiki
## Requirements

1. [Requirements](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Requirements)
2. [Features](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Features)
3. [Settings](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Settings)
4. [Useful extensions](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Useful-extensions)
5. [Known issues](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Known-Issues)
6. [Roadmap](https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Roadmap)
It is recommended to install the [Crystal programming language](https://crystal-lang.org/) (platform dependendant). No other dependencies are required.
For debugging support, it's recommended to follow the guide [here](https://dev.to/bcardiff/debug-crystal-in-vscode-via-codelldb-3lf).

## Features

- Syntax highlighting:
- Syntax highlighting support for Crystal, [Slang](https://github.com/jeromegn/slang), and [ECR](https://crystal-lang.org/api/latest/ECR.html) (contributions for other Crystal templating languages welcome)
- Auto indentation:
- Automatically indent while coding (after `do`, `if`, etc.)
- Snippets:
- Helpful code completions for common use-cases
- Formatting
- Allows for "format on save" and manual formatting, and works even if the editor isn't saved to disk
- Problems finder
- When enabled, on opening or saving a file the project will be compiled to find any problems with the code, and these problems are reported in the editor. Depending on the project this can be slow and memory intensive, so there is an option to disable it.
- Document symbols
- Allows for easier code navigation through breadcrumbs at the top of the file, as well as being able to view and jump to the documents symbols
- Peek / go to definition
- When enabled, this allows for quickly jumping to the definition(s) for a method using the `crystal tool implementations` command
- Show type on hover
- When enabled, this allows for viewing the type of a variable or return type of a method on hover, using the `crystal tool context` command
- Tasks
- Enables executing various `crystal`/`shards` commands directly from VSCode

## Settings

- `compiler` - set a custom absolute path for the Crystal compiler
- `definitions` - enables jump-to-definition (reload required)
- `dependencies` - use the dependencies tool to determine the main for each file, required if there's multiple entrypoints to the project, can be slow
- `flags` - flags to pass to the compiler
- `hover` - show type information on hover (reload required)
- `main` - set a main executable to use for the current project (`${workspaceRoot}/src/main.cr`)
- `problems` - runs the compiler on save and reports any issues (reload required)
- `server` - absolute path to an LSP executable to use instead of the custom features provided by this extension, like [Crystalline](https://github.com/elbywan/crystalline) (reload required)
- `shards` - set a custom absolute path for the shards executable
- `spec-explorer` - enable the built-in testing UI for specs, recommended for Crystal >= 1.11 due to `--dry-run` flag (reload required)
- `spec-tags` - specific tags to pass to the spec runner

By default, the problems runner, hover provider, and definitions provider are turned on. This may not be ideal for larger projects due to compile times and memory usage, so it is recommended to turn them off in the vscode settings. That can be done per-project by creating a `.vscode/settings.json` file with:

```json
// .vscode/settings.json
{
// Turn off slow/memory-intensive features for larger projects
"crystal-lang.definitions": false,
"crystal-lang.dependencies": false,
"crystal-lang.hover": false,
"crystal-lang.problems": false,
"crystal-lang.spec-explorer": false,
}
```

## Supported Platforms

This extension has been tested on / should work on the following platforms:

- Linux (Arch / Ubuntu / Fedora)
- MacOS (Intel / Apple Silicon)
- Windows (10 Native / 10 WSL2 / 11)
- GitHub Codespaces

## Roadmap

These are some features that are planned or would be nice for the future of this project or others:

- Better / faster LSP support
- Better completion algorithm
- Better symbol detection
- Integrated debugger support
- Refactored task runner

## Release Notes

Expand Down
Binary file added images/vscode-example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 32abd48

Please sign in to comment.