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

Mono-repoize Calyx LSP + Tree-sitter #1922

Merged
merged 19 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revamp README, add license and logo to package.json
  • Loading branch information
sgpthomas committed Feb 22, 2024
commit 6b9e161555adc95eed6f183b755e0fb819518e53
1 change: 1 addition & 0 deletions tools/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/out/
*.vsix
5 changes: 5 additions & 0 deletions tools/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/**
.gitignore
node_modules
src/
tsconfig.json
9 changes: 9 additions & 0 deletions tools/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "calyx" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
7 changes: 7 additions & 0 deletions tools/vscode/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Cornell University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 17 additions & 5 deletions tools/vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Calyx README

Calyx VSCode Extension. I've separated this from the previous one for now, just because it was easier to generate from scratch from the `yo` tool and I don't know how these things work.
Calyx VSCode Extension that adds basic syntax highlighting and integrates the Calyx LSP server for jump to definition, and autocomplete.

I'm experimenting integrating the Calyx language server with this extension. At the moment, jump to definition works.
## Installation

## Trying this out
You can install the extension from the VSCode store by searching for Calyx. Alternatively, you can link this directory directly into your vscode extensions folder:

You need to clone and build the language server: https://github.com/calyxir/calyx-lsp
```bash
cd $HOME/.vscode/extensions
ln -s <calyx root directory>/tools/vscode calyx.calyx-1.0.0
```

And then you need to edit the language server path in `src/extension.ts` and then build the extension with `npm run compile`. You can test out the extension with `code --extensionDevelopmentPath=$PWD` from the extension directory. Reloading it, picks up future changes.
Then reload VSCode.

## LSP Integration

For the LSP integration, you also need `calyx-lsp` installed. You can build it with `cargo build --all` from the Calyx root directory. Then link the executable to your path:

```bash
cd $HOME/.local/bin
ln -s <calyx root directory>/target/debug/calyx-lsp calyx-lsp
```
Binary file added tools/vscode/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 38 additions & 15 deletions tools/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,44 @@
"name": "calyx",
"displayName": "Calyx",
"description": "Provides language support for Calyx",
"version": "0.0.1",
"version": "1.0.0",
"license": "SEE LICENSE IN LICENSE",
"homepage": "https://github.com/calyxir/calyx",
"publisher": "Calyx Team",
"icon": "logo.png",
"repository": {
"type": "git",
"url": "https://github.com/calyxir/calyx.git"
},
"engines": {
"vscode": "^1.85.0"
},
"categories": [
"Programming Languages"
],
"activationEvents": [],
"main": "./out/extension.js",
"main": "./out/main.js",
"contributes": {
"languages": [{
"id": "calyx",
"aliases": ["Calyx", "calyx"],
"extensions": [".futil"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "calyx",
"scopeName": "source.calyx",
"path": "./syntaxes/calyx.tmLanguage.json"
}],
"languages": [
{
"id": "calyx",
"aliases": [
"Calyx",
"calyx"
],
"extensions": [
".futil"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "calyx",
"scopeName": "source.calyx",
"path": "./syntaxes/calyx.tmLanguage.json"
}
],
"commands": [],
"configuration": {
"type": "object",
Expand All @@ -31,14 +48,19 @@
"calyxLsp.libraryPaths": {
"scope": "resource",
"type": "array",
"default": ["~/.calyx"],
"default": [
"~/.calyx"
],
"description": "Specifies the locations that Calyx libraries are installed."
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"vscode:prepublish": "npm run esbuild-base -- --minify",
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node",
"esbuild": "npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
Expand All @@ -53,6 +75,7 @@
"@typescript-eslint/parser": "^6.19.1",
"@vscode/test-cli": "^0.0.4",
"@vscode/test-electron": "^2.3.9",
"esbuild": "^0.20.1",
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
Expand Down
Loading