Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Implement support for multi folder workspaces #355

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sadesyllas
Copy link

This is an attempt to support the new multi folder workspaces feature.

I have completely changed my initial approach as described in #349 and instead opted for a far simpler change.

The main change is how CurrentWorkingDirectoryManager.cwd() works.

I can't say that I am aware of every aspect of this project and unfortunately I did not have the time to test absolutely everything after my changes but simply removing any use of rootPath and using the new workspaces API seems to be working for me without any problems during my usual, yet simple, workflow.

I the PR has a correct basis please provide feedback to change/correct any mistakes that I may have made.

Copy link
Member

@KalitaAlexey KalitaAlexey left a comment

Choose a reason for hiding this comment

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

I asked you some questions. I hope you'll find time to answer them.
Also I see some code duplicated.
I didn't analyze your PR deeply.
I'll do it soon.
Anyway thank you for your contribution.

package.json Outdated
@@ -2,7 +2,7 @@
"name": "vscode-rust",
"displayName": "Rust",
"description": "Rust language integration for VSCode",
"version": "0.4.2",
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why you want to increase the version of the extension?

Copy link
Author

Choose a reason for hiding this comment

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

Your are right, I shouldn't have done so. I have reverted the change.

if (!name || name.length === 0) {
this._currentWorkingDirectoryManager.cwd().then(cwd => {
if (!cwd) {
window.showErrorMessage('Current document not in the workspace');
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be "Current document is not in the workspace", shouldn't it?

Copy link
Author

Choose a reason for hiding this comment

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

I believe that it was already written this way. Apart from refactoring that part I did not change the string's content. But now that you have mentioned it, I just amended it. 😃

@@ -93,7 +102,7 @@ export class CurrentWorkingDirectoryManager {

return this.checkPathExists(pathToCargoTomlInPreviousCwd).then<string>(exists => {
if (exists) {
return Promise.resolve(this.rememberedCwd);
return Promise.resolve(<string>this.rememberedCwd);
Copy link
Member

Choose a reason for hiding this comment

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

What is the change for?

Copy link
Author

Choose a reason for hiding this comment

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

This was done so that the linter would stop nagging since there, we say that we will eventually return a Promise<string>, but when resolving with Promise.resolve(this.rememberedCwd), the final type of the promise that we are returning is actually Promise<string|undefined>.

Thus, to get rid of the inconsistency I wrote it explicitly since at that point we will not return undefined.

Copy link

@Frizi Frizi Sep 27, 2017

Choose a reason for hiding this comment

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

I believe it could be spelled like this.rememberedCwd!, just to drop the undefined type. That way you still propagate the string type instead of asserting it.

Copy link
Author

Choose a reason for hiding this comment

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

@Frizi, you are correct, I changed that part to this.rememberedCwd! as per your comment.

@sadesyllas
Copy link
Author

@KalitaAlexey, did you have time to check the PR?

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

Successfully merging this pull request may close these issues.

3 participants