Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add SPI for Completions #14054

Merged
merged 8 commits into from
Mar 20, 2019
Merged

Conversation

rasika
Copy link
Contributor

@rasika rasika commented Mar 2, 2019

Purpose

Currently Code Actions and Code Lenses provides easy-to-plug SPIs to make the maintenance and development cycle faster. This PR moves completions into SPIs as well.

Context Resolving logic and completion items population are separated-out into two layers(resolvers & providers).

Sample

You can create your own CompletionProvider implementing the interface LSCompletionProvider. For example; LSDefaultCompletionItemProvider.

This PR resolves #13928

rasika added 8 commits March 2, 2019 09:30
This is due to recent changes of making endpoint and object and
resource a function.

Signed-off-by: Rasika <info.rasika@gmail.com>
Moved to BallerinaParser.AnnotationAttachmentContext.class to make the
API clean. All context resolvers map into either native construct (such
as BLangBlockStmt, BLangFunction etc.) or ParserRuleContext

Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
Signed-off-by: Rasika <info.rasika@gmail.com>
@rasika rasika added Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement labels Mar 2, 2019
@codecov-io
Copy link

codecov-io commented Mar 2, 2019

Codecov Report

Merging #14054 into master will increase coverage by 2.21%.
The diff coverage is 71.82%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #14054      +/-   ##
============================================
+ Coverage     65.26%   67.47%   +2.21%     
- Complexity      426      486      +60     
============================================
  Files          2124     2303     +179     
  Lines         94502   116473   +21971     
  Branches      12562    18438    +5876     
============================================
+ Hits          61676    78595   +16919     
- Misses        27825    32506    +4681     
- Partials       5001     5372     +371
Impacted Files Coverage Δ Complexity Δ
...ons/util/sorters/EndpointDefContextItemSorter.java 5% <ø> (ø) 0 <0> (ø) ⬇️
...ons/util/sorters/VariableDefContextItemSorter.java 100% <ø> (+4.16%) 0 <0> (ø) ⬇️
...completions/util/sorters/CompletionItemSorter.java 72% <ø> (ø) 0 <0> (ø) ⬇️
...s/util/sorters/ConditionalStatementItemSorter.java 5.55% <ø> (ø) 0 <0> (ø) ⬇️
...erinalang/langserver/common/utils/FilterUtils.java 78.76% <ø> (ø) 0 <0> (ø) ⬇️
...pletions/util/filters/StatementTemplateFilter.java 95.65% <ø> (ø) 0 <0> (ø) ⬇️
...ions/util/sorters/AssignmentStmtContextSorter.java 9.09% <ø> (ø) 0 <0> (ø) ⬇️
...ions/util/filters/DelimiterBasedContentFilter.java 77.45% <ø> (ø) 0 <0> (ø) ⬇️
...tions/util/sorters/StatementContextItemSorter.java 16.66% <ø> (ø) 0 <0> (ø) ⬇️
...completions/util/filters/AbstractSymbolFilter.java 100% <ø> (ø) 0 <0> (ø) ⬇️
... and 444 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 356f6bd...eda3eac. Read the comment docs.

Copy link
Contributor

@nadeeshaan nadeeshaan left a comment

Choose a reason for hiding this comment

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

Very cleaner approach for the completion architecture.

@nadeeshaan nadeeshaan closed this Mar 19, 2019
@nadeeshaan nadeeshaan reopened this Mar 20, 2019
@nadeeshaan nadeeshaan merged commit 39afea5 into ballerina-platform:master Mar 20, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce SPIs for Completions
3 participants