Comments (16)
There is one advantage of doing it in the editor: we could run a different Lean version in every directory.
You also need to write extra code for neovim if you want multiple servers. The manual even includes a nice two-page code snippet for it: https://neovim.io/doc/user/lsp.html (And yes, you need to forward the goal command to the right server yourself.)
from vscode-lean4.
Seriously, what is the point of the watchdog architecture then?
The worker processes also need to be restarted when the header changes.
from vscode-lean4.
Technically, it seems to be possible to start a different server for each folder. Apparently the LSP library for vscode allows you to restrict a server to a subdirectory. We'd just need to start a server for each workspace folder, and stop them when the folder is removed, etc. We'd also need to aggregate the responses from the different servers for the info view, etc. :-/
But if we implement support for multiple servers, we could also cut out the middle management and execute the workers directly.
Seriously, what is the point of the watchdog architecture then? Apparently emacs would also need extra code to manage multiple servers, if I read the linked issue correctly. IMHO this should be handled in the Lean server once and for all and not in every editor (in potentially different and incompatible ways).
cc @Vtec234
from vscode-lean4.
I only know the VS Code API from hearsay, but the watchdog architecture was created under the impression that it was not possible to start a server per file. For Emacs at least this is true, lsp-mode
will start one server per workspace and has no idea about multi-folder workspaces. So there is nothing to do on the Emacs side.
from vscode-lean4.
We'd also need to aggregate the responses from the different servers for the info view, etc. :-/
I had no idea the info view will show messages from multiple folders (though I guess it naturally follows from the current setup)
. Is that even desirable?
from vscode-lean4.
And then of course there is the actual watchdog part, where we might want to be even more careful about restarting workers than we already are given the recent bug reports. I wouldn't want to put that into every client.
from vscode-lean4.
I had no idea the info view will show messages from multiple folders (though I guess it naturally follows from the current setup). Is that even desirable?
Oh no, it won't. But it will communicate with the server, e.g. to request the goal state. So we need some abstraction to send these requests to the correct server.
from vscode-lean4.
I had no idea the info view will show messages from multiple folders (though I guess it naturally follows from the current setup). Is that even desirable?
Oh no, it won't. But it will communicate with the server, e.g. to request the goal state. So we need some abstraction to send these requests to the correct server.
I see. But so does VS Code for every built-in requests, can we reuse that?
from vscode-lean4.
I see. But so does VS Code for every built-in requests, can we reuse that?
Not really. The LSP library registers itself as e.g. a definition provider for the specified subdirectory, and then it will get the go-to definition requests for that subdirectory.
But aside from that there's no support for running multiple servers. You literally need to start them yourself for every directory, keep track of them, etc. And if you have custom commands, you need to redirect them yourself.
from vscode-lean4.
For Emacs at least this is true, lsp-mode will start one server per workspace and has no idea about multi-folder workspaces.
So how does this work with emacs? Do you need to run a separate emacs instance for every lean project? Does it matter which directory you start emacs from?
from vscode-lean4.
The worker processes also need to be restarted when the header changes.
Ah, so interfacing with the workers directly is not an option then.
from vscode-lean4.
For Emacs at least this is true, lsp-mode will start one server per workspace and has no idea about multi-folder workspaces.
So how does this work with emacs? Do you need to run a separate emacs instance for every lean project? Does it matter which directory you start emacs from?
No, you can open multiple workspaces in a single Emacs instance. Each server is started in the workspace root dir. But it looks like lsp-mode also supports multi-root workspaces and will start a single server for them if you set multi-root
when calling make-lsp-client
. In either case, lsp-mode completely takes care of managing the processes. This is confusing...
from vscode-lean4.
So, I'm not opposed to making the server folder-aware, which is probably the right choice in the long term. Coming from lsp-mode and the server code it just seemed easier to tell VS Code to behave like Emacs since that was explicitly listed as an option in their documentation.
from vscode-lean4.
https://github.com/microsoft/vscode/wiki/Adopting-Multi-Root-Workspace-APIs
from vscode-lean4.
Yes, we're aware. leanprover/lean4#300 (comment)
from vscode-lean4.
I was just adding that link for my own benefit, I'm working on this in PR# #104
from vscode-lean4.
Related Issues (20)
- 'Error updating' infoview error in fresh install on Windows 10
- Waiting for Lean server to start confusing message HOT 8
- Suggest adding a `.vscode/settings.json` HOT 2
- Display a warning if "lean4.toolchainPath" is set? HOT 3
- Autoclosing convention for unicode brackets
- Abbreviations leave trailing spaces/don't advance cursor HOT 6
- RFC: `cmd-shift-x` opens the extensions sidebar HOT 6
- "Opened folder is not a valid Lean 4 project" warning after creating new project HOT 4
- Extension doesn't play nice with msys2
- Install Lean using Elan (Windows) Start-BitsTransfer : Object reference not set to an instance of an object. HOT 9
- Download project using ssh
- The "Install Lean" button mentions Elan, but users may not know what this is HOT 3
- Illegible colors in infoview on selection
- Autocomplete not working, vscode falls back to the default. HOT 2
- server out of sync with file when editing imports on Windows
- HTML-ish content in docstrings causes incorrect highlighting after them HOT 2
- Regular "Error: Unable to replace abbreviation" on unicode replacement over ssh HOT 1
- RFC: jump to definition in context menu in infoview HOT 2
- RFC: deselect all in info view
- Extension does not respect elan override when first started HOT 1
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 vscode-lean4.