Skip to content
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

feat: establish language server service for the graphical editor #1315

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

GideonKoenig
Copy link
Contributor

Related to #1243.

Summary of Changes

Adds a language server service that provides the necessary components for the graphical editor.

@GideonKoenig
Copy link
Contributor Author

Currently, this PR is still missing the necessary tests for the parser components.
Tests for the Document Parser will get added.

Testing components that are not related to ParseDocument (specifically, OpenSyncChannel, CloseSyncChannel, GetBuildings, and GetDocumentation) is currently not planned.

@lars-reimann If these components require testing, please let me know.

Copy link

github-actions bot commented Jan 21, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ REPOSITORY git_diff yes no 0.14s
✅ TYPESCRIPT eslint 17 0 0 4.62s
✅ TYPESCRIPT prettier 17 0 0 1.09s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 20.55961% with 653 lines in your changes missing coverage. Please review.

Project coverage is 95.00%. Comparing base (373d404) to head (1100ecb).

Files with missing lines Patch % Lines
...g/src/language/graphical-editor/ast-parser/call.ts 5.32% 160 Missing ⚠️
...uage/graphical-editor/graphical-editor-provider.ts 30.66% 104 Missing ⚠️
...src/language/graphical-editor/ast-parser/parser.ts 14.28% 96 Missing ⚠️
.../language/graphical-editor/ast-parser/statement.ts 10.38% 69 Missing ⚠️
...e/graphical-editor/ast-parser/tools/debug-utils.ts 9.43% 48 Missing ⚠️
...language/graphical-editor/ast-parser/expression.ts 15.38% 44 Missing ⚠️
...rc/language/graphical-editor/ast-parser/segment.ts 14.28% 36 Missing ⚠️
...g/src/language/graphical-editor/ast-parser/edge.ts 37.50% 25 Missing ⚠️
...afe-ds-lang/src/language/graphical-editor/types.ts 37.50% 15 Missing ⚠️
...c/language/graphical-editor/ast-parser/argument.ts 27.77% 13 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1315      +/-   ##
==========================================
- Coverage   99.72%   95.00%   -4.73%     
==========================================
  Files         119      134      +15     
  Lines       12955    13777     +822     
  Branches     4240     4248       +8     
==========================================
+ Hits        12920    13089     +169     
- Misses         35      687     +652     
- Partials        0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GideonKoenig
Copy link
Contributor Author

@lars-reimann
Before reviewing this, see my comment here.

@GideonKoenig
Copy link
Contributor Author

Bug 1
Has been resolved, among some other small issues.

Bug 2
This seems the be an issue with langium, or an issue with how I use the provided services.

this.logger.error(`Parsing document <${uri.path}>`);
const document = await this.LangiumDocuments.getOrCreateDocument(uri);
this.logger.error(`Document created <${document.uri.path}>`);
await this.DocumentBuilder.build([document]);
this.logger.error(`Document built <${document.uri.path}>`);

I added these debug logging statements in the parseDocument function in the language server, then opened first the complex-titanic.sds file in the editor, then closed the graphical editor, and the opened .sds document, then opened the simple-titanic.sds file in the text editor, and then the graphical editor.

These log statements were produced after opening the simple-titanic.sds file:

2025-01-22 00:16:33.692 [error] [Graphical Editor] Parsing document </c:/Users/Gideon/projects/safe-ds/packages/safe-ds-editor/samples/simple-titanic.sds>
2025-01-22 00:16:33.693 [error] [Graphical Editor] Document created </c:/Users/Gideon/projects/safe-ds/packages/safe-ds-editor/samples/complex-titanic.sds>
2025-01-22 00:16:33.693 [error] [Graphical Editor] Document built </c:/Users/Gideon/projects/safe-ds/packages/safe-ds-editor/samples/complex-titanic.sds>

So it seems that this line:

const document = await this.LangiumDocuments.getOrCreateDocument(uri);

produces the old document, when using the new uri.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant