-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enhance LSP for multi-editor support #38
base: main
Are you sure you want to change the base?
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 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, looks good, just we need to resolve few moments...
@@ -68,12 +69,12 @@ async function validate(document: TextDocument) { | |||
let newDocumentsWithErrors: any = []; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the web version, similar to the Monaco editor, a few additional changes are required. I'll push those by this weekend.
} | ||
let difference = documentsWithErrors.filter((x: any) => !newDocumentsWithErrors.includes(x)); | ||
// 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]}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as "file://" above.
@@ -39,14 +39,23 @@ export class TactCompiler { | |||
} | |||
|
|||
const pathKey = path.relative( this.rootPath, args.file).replaceAll('\\','/'); | |||
|
|||
let rootPath = this.rootPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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