-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
325 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build | ||
jpm_tree/** | ||
.clj-kondo | ||
.lsp | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Caleb Figgers | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,73 @@ | ||
# Janet Language Server | ||
|
||
## Building | ||
A Language Server (LSP) for the Janet programming language. | ||
|
||
### Building for Linux | ||
# Overview | ||
|
||
```shell | ||
jpm clean && jpm build --lflags=-export-dynamic | ||
``` | ||
The goal of this project is to provide an augmented tooling experience for [Janet](https://janet-lang.org), via a self-contained, [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)-compliant language server (which is itself implemented in Janet!). | ||
|
||
`export-dynamic` is required for the server to load arbitrary Janet native | ||
modules when it evaluates user documents. Otherwise the symbols for Janet would | ||
not be visible to the newly loaded modules and they would fail to load. | ||
Current features include: | ||
- [x] Partial auto-completion based on defined symbols | ||
- [x] On-hover definition of symbols as returned by `(doc ,symbol)` | ||
- [x] Inline compiler errors | ||
|
||
### Building for Windows | ||
Planned features include: | ||
- [ ] Additional autocompletion support | ||
- [ ] Jump to definition/implementation | ||
- [ ] Find references from definition/implementation | ||
- [ ] Refactoring helps | ||
- [ ] Symbol renaming helps | ||
|
||
``` | ||
"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
``` | ||
Possible (but de-prioritized) features include: | ||
- [ ] Syntax highlighting for Janet via semantic tokens | ||
|
||
Desirable but possibly more complicated/difficult features include: | ||
- [ ] Stand-alone (i.e. non-Editor-dependent) usage via API/CLI | ||
|
||
# Caveats | ||
|
||
- Windows/MacOS support is completely untested and therefore unknown. | ||
- The only editor integration currently tested against is [Visual Studio Code](https://code.visualstudio.com/). | ||
- I've never written a language server before, so I don't really know what I'm doing. Help me, if you'd like! | ||
|
||
# Clients (i.e. Editors) | ||
|
||
Currently, the only editor tested and known working with janet-lsp is [Visual Studio Code](https://code.visualstudio.com/), which you can try/take advantage of by installing the [Janet++](https://github.com/CFiggers/vscode-janet-plus-plus) extension [from the VS Code marketplace](https://www.example.com). | ||
|
||
Other editors that implement LSP client protocols, either built-in or through editor extensions, include: | ||
- Emacs | ||
- vim/neovim | ||
- Sublime Text | ||
- Helix | ||
- Kakoune | ||
|
||
If you get janet-lsp working with any of these options, please let me know! | ||
|
||
# Getting Started (for Development) | ||
|
||
## Clone this project and Build the stand-alone binary | ||
|
||
Requires [Janet](https://github.com/janet-lang/janet) and [jpm](https://github.com/janet-lang/jpm). | ||
|
||
```shell | ||
jpm clean && jpm build --lflags=/OPT:NOREF | ||
$ git clone https://github.com/CFiggers/janet-lsp | ||
$ cd janet-lsp | ||
$ jpm deps | ||
$ jpm build | ||
``` | ||
|
||
## Installing | ||
|
||
The following command should copy the `janet-language-server` binary to a location that can be executed via the command line. | ||
The following command will copy the `janet-lsp` binary to a location that can be executed via the command line. | ||
|
||
```shell | ||
$ jpm install | ||
``` | ||
jpm install | ||
``` | ||
|
||
# Contributions | ||
|
||
Issues and Pull Requests welcome. | ||
|
||
# Prior Art | ||
|
||
This project is a hard fork from (and with much appreciation to) [JohnDoneth/janet-language-server](https://github.com/JohnDoneth/janet-language-server), which is Copyright (c) 2022 JohnDoneth and contributors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
(declare-project | ||
:name "janet-language-server" | ||
:description "Language Server for the Janet Programming Language" | ||
:version "0.0.0" | ||
:dependencies [ | ||
"https://github.com/janet-lang/spork.git" | ||
]) | ||
:name "janet-lsp" | ||
:description "A Language Server (LSP) for the Janet Programming Language" | ||
:version "0.0.1" | ||
:dependencies ["https://github.com/janet-lang/spork.git" | ||
"https://github.com/ianthehenry/judge.git"]) | ||
|
||
(declare-executable | ||
:name "janet-language-server" | ||
:name "janet-lsp" | ||
:entry "src/main.janet" | ||
:install true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(defn init-logger [] | ||
(setdyn :out stderr) | ||
(setdyn :logfile (file/open "janetlslogs.txt" :w))) | ||
|
||
(defn shutdown-logger [] | ||
(file/close (dyn :logfile))) | ||
|
||
(defn log [output] | ||
(file/write stderr (string output "\n"))) |
Oops, something went wrong.