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

Fix handling null workspace folder and untitled document #461

Merged
merged 5 commits into from
Jul 26, 2021

Conversation

renkun-ken
Copy link
Member

Closes #460

This PR makes handling null workspace folder and untitled document with the following logic:

  1. If the workspace folder is not null, then use it as the root path.
  2. Otherwise, if path from uri is not empty, use the directory of the path.
  3. Otherwise, the uri is not a file:// uri, then use the working directory of the language server process.

@renkun-ken
Copy link
Member Author

renkun-ken commented Jul 24, 2021

Currently, our test util functions do not directly support working with untitled documents, as they only accept path instead of uri. Should we generalize the respond_* functions so that they could also work with uri, or we directly use respond() in the tests for untitled documents which is only a tiny portion of the test cases, maybe not worth making any changes to specific respond_* functions.

@randy3k
Copy link
Member

randy3k commented Jul 24, 2021

I think it should not be too difficult to support it. By the way, what will be the uri for untitled files? (Too lazy to check)

@renkun-ken
Copy link
Member Author

Uri for untitled document is in the form of untitled:Untitled-1.

Also, there are other potential uri format like vscode-notebook-cell://home/ken/test.Rmd#000001 to represent a VS Code notebook cell in a notebook editor.

@renkun-ken renkun-ken requested a review from randy3k July 25, 2021 08:36
@renkun-ken
Copy link
Member Author

I updated the test util functions by supporting uri input directly.

Copy link
Member

@randy3k randy3k left a comment

Choose a reason for hiding this comment

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

LGTM.

@renkun-ken renkun-ken merged commit 05e7e67 into REditorSupport:master Jul 26, 2021
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.

Null workspace folder not working with untitled documents
2 participants