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

refactor(language service): Clean up the language service interface #831

Merged

Conversation

jpinkney-aws
Copy link
Contributor

What does this PR do?

Some of the functionality currently exposed by the language service doesn't make sense when running the language service as a library rather than through the language server. This PR seeks to clean up some of those cases by marking connection, telemetry, and yamlSettings as optional

What issues does this PR fix or reference?

None

Is it tested? How?

Tested by running npm run test and then ensuring that VSCode-YAML works with these changes

@coveralls
Copy link

coveralls commented Jan 17, 2023

Coverage Status

Coverage: 83.265% (+0.02%) from 83.241% when pulling 86d0fc5 on jpinkney-aws:jpinkney-aws/refactor-library into 762209c on redhat-developer:main.

@gorkem
Copy link
Collaborator

gorkem commented Jan 25, 2023

We have really not put an effort to support language service as a library, it is not something we regularly check for. Are there any tests that can be added so that this does not get broken in the future.

@nkomonen-amazon
Copy link
Contributor

Hey @gorkem, I'm going to be more involved with API changes to the YAML service.

Are there any tests that can be added so that this does not get broken in the future.

IMO this isn't really related to anything we can test against. It is more related to the overall design which would have needed to been addressed in the initial design of the function.

The root change of this PR is here, which is making the non-essential arguments of the core YAML Language Service optional. They are not essential to core language service functionality and most users of the API will not need the functionality they provide.

Without this PR it forces complex creation of unnecessary objects to get access to the language service.


I think there is some work we can do to improve this API and would be interested in contributing to it. I've seen lots of use of the language service api, so I think this is something that would be beneficial to the community.

@gorkem
Copy link
Collaborator

gorkem commented Feb 22, 2023

This is awesome. It is a reunion with my oldterns :)

I think I understand what the PR is trying to achieve. I think there should be a test that tries to initialize the language service as you described and check if it works as expected. Otherwise, we do not regularly test the project in such usage.

@amisevsk
Copy link

Just popping in to join the reunion :D

@nkomonen-amazon
Copy link
Contributor

Its a small world in the IDE space :) I never thought I'd have a reunion on a Github issue lol.

I think there should be a test that tries to initialize the language service

I see now, that makes sense. I'll add that in to this PR soon. Thanks :)

@nkomonen-amazon nkomonen-amazon force-pushed the jpinkney-aws/refactor-library branch 2 times, most recently from 4bb68cc to f9ca463 Compare February 23, 2023 17:29
@gorkem
Copy link
Collaborator

gorkem commented Mar 10, 2023

@nkomonen-amazon the new test is failing for me locally and at CI too.

jpinkney-aws and others added 3 commits March 13, 2023 14:11
Problem:
- Some of the functionality currently exposed by the language service doesn't make sense when running the language service as a library rather than through the language server

Solution:
- Clean up the language service interface and mark connection, telemetry, and yamlSettings as optional
This adds some tests to:

- Test against the minimal arguments needed for
  the getLanguageService() api
- Test the happy path of the hover functionality
  to ensure hover works without any of the optional
  arguments.

Signed-off-by: Nikolas Komonen <nkomonen@amazon.com>
From a previous change, when creating a hover
indentations were replaced with the html entity
non breaking space.

The issue is that the indentation property
is optional and this was not considered in that
change. Due to this the markdown content would
be incorrect.

This change performs the markdown content modification
only when the expected parameters exist.

Signed-off-by: Nikolas Komonen <nkomonen@amazon.com>
@nkomonen-amazon
Copy link
Contributor

@gorkem I've updated with a new commit that fixes the issue

@gorkem
Copy link
Collaborator

gorkem commented Mar 26, 2023

@msivasubramaniaan Can you check this one?

@fbricon
Copy link
Contributor

fbricon commented Mar 31, 2023

@jpinkney-aws @nkomonen-amazon damn I didn't even see you leave

@gorkem gorkem merged commit 58618b9 into redhat-developer:main Mar 31, 2023
@jpinkney-aws jpinkney-aws deleted the jpinkney-aws/refactor-library branch March 31, 2023 17:38
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.

6 participants