Comments (10)
Ah, understood—here, let me push the update to the Open VSX registry so you can give it a try.
from janet-lsp.
That's live now on Open VSX—I don't know how long it will take to propagate but once you see it it should be good to go :)
from janet-lsp.
Thanks! I just tried it out, and it works, no configuration needed!
How does it work under the hood?
from janet-lsp.
I see, cool setup!
I gotta read up in Janet's Handling of it's lib paths. I thought they needed the Env bar set for a setup like mine.
Kudos, the plugin/lsp works like magic! 😄
from janet-lsp.
I've been working on this over the last few days and I might have a (temporary?) solution for you.
Could you please try running janet ./src/main.janet
instead of the compiled janet-lsp
executable and let me know what, if anything, changes?
from janet-lsp.
I'm currently using it via the vscode extension, how can I run a custom lsp server with it?
from janet-lsp.
I just realized that this may be more of a problem with https://github.com/CFiggers/vscode-janet-plus-plus
Maybe just setting some env vars in the extension before starting the lsp server might work?
from janet-lsp.
Oh good, if you're using Janet LSP via Janet++ then this is super easy! Just go to the Janet++ extension page and click "Switch to Pre-Release Version":
![image](https://private-user-images.githubusercontent.com/55862180/278434058-cf81e223-938a-4ce8-8394-4194cec7c622.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNzcxMDAsIm5iZiI6MTcyMDA3NjgwMCwicGF0aCI6Ii81NTg2MjE4MC8yNzg0MzQwNTgtY2Y4MWUyMjMtOTM4YS00Y2U4LTgzOTQtNDE5NGNlYzdjNjIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDA3MDY0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNiN2Q2MTI1MWYwZjg3ZmVkMDljOGMzMjE5ZmEwZDcyMGNhNDdiZDQ0MjYxZDBiYTBhM2VmMTM1NmI5MzljNDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WkyQfCfqBUpaP7wkh898MvZSab6Ec1vihorZ3kW_PyM)
If it works well for you then you'll be the fourth person (that I know of) for whom this release candidate is more stable re: module discovery and I'll be moving it toward general release ASAP.
from janet-lsp.
I don't have this option, possibly because I'm using the OSS version of vscode.
I'm currently traveling, but I could try it out with the Microsoft version later
from janet-lsp.
I appreciate the question! 🙂 Which "it" are you referring to? The LSP as a whole? Or specifically this update that makes it work with user-local installs?
Assuming you probably mean the latter, it's working by shipping a .jimage file rather than a compiled executable, which is what we were doing before. The extension checks your path to make sure that janet
is available—if not, it doesn't start the LSP, but if so it invokes your own Janet install, wherever you have it, to load in the .jimage and run the server from there.
That has a couple of benefits—for starters, it's intrinsically cross-platform (Windows, Linux, Mac, BSD, NixOS) and architecture-indifferent (x86_64, Arm64, M1 Apple Silicon, Raspberry PI, RISC-V, even TIC-80 I presume—anywhere Janet works, the LSP should also work seamlessly). And all that WITHOUT needing me to compile and ship separate executables for each OS/Architecture combo. Janet runs as an Abstract Machine anyhow, may as well get the benefits of it!
Second, since it's running on YOUR Janet install, it'll always have access to any libraries you have installed and it'll error on any you don't—I don't need to know in advance what you have installed, or don't, or where you put them. If YOUR Janet can find a module, then so can the LSP, because it's literally running on YOUR copy of Janet. That also means the LSP can warn you when you are trying to import a library that you haven't installed yet.
Third, we shouldn't have any issues with Janet version mismatches, like if you update your Janet to 1.32.1 but the last time I built and distributed Janet++ I was running Janet 1.31 (this happened last week—there's a closed issue about it somewhere). From this update on, the LSP is running on YOUR Janet, whatever version that may be. So, for e.g., if bakpakin adds new core functions in 1.33 and you update, those will automatically be recognized for hover-over documentation (since YOUR updated Janet will have them in its environment table, so the hover function will have access to call :doc
on them, all of which will work without me needing to ship a new version of Janet++). I would still need to add those new functions to the syntax highlighting in Janet++, but the hover docs will instantly work regardless.
There's nothing magic about the .jimage specifically, all the same benefits would apply if I shipped the full Janet source for the LSP and had Janet run it as a script. The .jimage just saves a bit of startup time because Janet doesn't have to compile before running, and it makes the build process on my end a little cleaner, since the LSP can ship as a single .jimage file rather than multiple .janet files in a directory tree.
from janet-lsp.
Related Issues (11)
- Make Janet LSP evaluation error tolerant HOT 8
- Buggy behavior when `jpm_tree` exists HOT 1
- Add debug console functionality to Janet LSP HOT 1
- Module imports not working on Windows HOT 4
- Bug: In Janet++, backspacing over a top-level form crashes the LSP
- startup.janet stopped working HOT 3
- Neovim: Diagnostics are not cleared when none remain HOT 3
- Problem communicating with helix HOT 1
- Implement Signature Help HOT 1
- Better Sandboxing of User Code HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from janet-lsp.