Enhance LSP for multi-editor support#38
Conversation
- Moved code formatting from the VSCode extension to the LSP server. - Removed VSCode specific dependencies from code formatting to create a unified, editor-agnostic approach. - Updated runCompilation method to correctly handle files opened without a workspace directory, ensuring seamless functionality in single-file contexts. - Switched document sync strategy from full to incremental for improved performance.
|
Thank you for your contribution! I'll check it next weekend. |
|
This PR also resolves #29, as it enables formatting capabilities in the LS 🚀 |
logvik
left a comment
There was a problem hiding this comment.
Sorry for the delay, looks good, just we need to resolve few moments...
| for (let fileName in compileErrorDiagnostics) { | ||
| newDocumentsWithErrors.push(URI.file(fileName).path); | ||
| connection.sendDiagnostics({diagnostics: compileErrorDiagnostics[fileName], uri: URI.file(fileName).path}); | ||
| connection.sendDiagnostics({diagnostics: compileErrorDiagnostics[fileName], uri: "file://"+URI.file(fileName).path}); |
There was a problem hiding this comment.
I am not sure about this. Will it work for web version? What for should we need add "file://"?
There was a problem hiding this comment.
For the web version, similar to the Monaco editor, a few additional changes are required. I'll push those by this weekend.
| // if an error is resolved, we must to send empty diagnostics for the URI contained it; | ||
| for(let item in difference) { | ||
| connection.sendDiagnostics({diagnostics: [], uri: difference[item]}); | ||
| connection.sendDiagnostics({diagnostics: [], uri: "file://"+difference[item]}); |
|
|
||
| const pathKey = path.relative( this.rootPath, args.file).replaceAll('\\','/'); | ||
|
|
||
| let rootPath = this.rootPath; |
There was a problem hiding this comment.
Could we change let rootPath = this.rootPath; on let localRootPath = this.rootPath; ? just because we can misunderstand later this.rootPath and rootPath
The same below by code. We can leave this, of course, just to better read the code.
Please decide.
There was a problem hiding this comment.
Yes that would be a better.
- The LSP can work independently without file system access for contracts. It must request the document from the client. - Create a documentStore to store the document in memory. - Fix the indentation for the `dump` function.
To use the LSP with other editors, refer to tact-extracted-ls.
Resolves #35