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

Improve completion behavior for cross references #1004

Merged
merged 3 commits into from
Apr 20, 2023

Conversation

msujew
Copy link
Member

@msujew msujew commented Mar 29, 2023

Fixes two minor issues:

  • In some grammars, the completion might be slightly different if we use the following AST node (i.e. the AST node right at the cursor position). In most languages, this is the correct behavior. We now create two separate contexts if the node after the cursor and the one before are different and create completion for both.
  • Sometimes, we evaluate the same keyword/cross reference multiple times over the course of the completion provider. Users would see the same proposals multiple times in their list. This change implements a deduplication algorithm, which removes duplicated entries.

@msujew msujew added the completion Completion related issue label Mar 29, 2023
@msujew msujew added this to the v1.2.0 milestone Mar 29, 2023
Copy link
Contributor

@dhuebner dhuebner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no tests, otherwise looks good to me.

@msujew
Copy link
Member Author

msujew commented Apr 20, 2023

@dhuebner I added a test for the deduplication. A test for the other minor bug is unfortunately rather difficult to build, since it requires a lot of scoping setup.

@msujew msujew merged commit d350aaa into main Apr 20, 2023
@msujew msujew deleted the msujew/deduplicate-completion branch April 20, 2023 12:38
emilkrebs added a commit that referenced this pull request May 15, 2023
* added missing arithmetics validations and potences and modulo operations

* added essential steps

* Fixed validation and the arithmetics language server

* fixed the arithmetics examples

* resolved the issues mentioned in 1013

* Normalize line endings for yeoman generator (#1005)

* Fix document highlighting for non-local references (#1000)

* [utils/streams] replicated signature overloads to 'StreamImpl'

this way they're also applied to vars of the ...Impl types
(TypeScript apparently doesn't apply interface overloads to implementing classes)

* Fixed invalid grammar validation error (#1020)

* Add validation for cross-reference to union type (#1017)

* Add validation for cross-reference to union type

* Update packages/langium/src/grammar/validation/validator.ts

Co-authored-by: Mark Sujew <mark.sujew@typefox.io>

* Update packages/langium/src/grammar/validation/validator.ts

Co-authored-by: Mark Sujew <mark.sujew@typefox.io>

* Return only one error for multiple non AST nodes

---------

Co-authored-by: Mark Sujew <mark.sujew@typefox.io>

* Fix build error (#1023)

Fixed build error

* Add IPA for 'Langium' (#1024)

* resolved the issues mentioned by @sailingfox

* Improve completion behavior for cross references (#1004)

* Automate release process (#1031)

* Publish version 1.2.0 (#1035)

* Add publishing permissions (#1036)

* fixed the language server

* Fix missing files in yeoman generator (#1038)

* Another fix for the broken `generator-langium` (#1040)

* Import types instead of import and prepare update to TS5.0 (#1018)

* Import types instead of import and prepare update to TS5.0

* Update yeoman generator test

* Remove hello-world from package-lock

* Fix import type in ast-generator.ts

* Fix rebase errors

* Rebase

* a small fix

* changed "default" to "case"

* improved arithmetics example

* throws an error when using a unsupported operator

* added comments and fixed some small issues

* added missing arithmetics validations and potences and modulo operations

* added essential steps

* Fixed validation and the arithmetics language server

* fixed the arithmetics examples

* resolved the issues mentioned in 1013

* resolved the issues mentioned by @sailingfox

* fixed the language server

* a small fix

* changed "default" to "case"

* improved arithmetics example

* throws an error when using a unsupported operator

* added comments and fixed some small issues

* fixed some rebasing issues

* added a $ to the evaluations array

---------

Co-authored-by: Mark Sujew <mark.sujew@typefox.io>
Co-authored-by: Christian Schneider <christian.schneider@typefox.io>
Co-authored-by: Guillaume Fontorbe <guillaume.fontorbe@typefox.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completion Completion related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants