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

Extension's context.storagePath randomly returns some undefined value #17089

Closed
fbricon opened this issue Dec 12, 2016 · 5 comments
Closed

Extension's context.storagePath randomly returns some undefined value #17089

fbricon opened this issue Dec 12, 2016 · 5 comments
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority verified Verification succeeded
Milestone

Comments

@fbricon
Copy link
Contributor

fbricon commented Dec 12, 2016

  • VSCode Version: 1.8.0-insider 40243d1 2016-12-09T12:04:24.015Z
  • OS Version: macOS 10.12

Steps to Reproduce:

Frequently, running vscode-java from source on a folder containing a java project, the Java Language Server fails to start because the workspace path that is sent is /undefined/redhat.java.

On the next start, the path would be something like /Users/username/Library/Application Support/Code - Insiders/User/workspaceStorage/644625e5a6a01f8af867112db58dc2e6/redhat.java

I haven't found a pattern to reproduce the issue reliably, but it's pretty frequent.

@jrieken jrieken added api bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority candidate Issue identified as probable candidate for fixing in the next release labels Dec 13, 2016
@jrieken jrieken added this to the November 2016 milestone Dec 13, 2016
@jrieken
Copy link
Member

jrieken commented Dec 13, 2016

Pretty confident this happens when opening just a file, not a folder. Based on that the following steps to reproduce:

  • have extension code as shown below, make it active eagerly
  • open a folder => it prints a path like /SOME/DIR/workspaceStorage/HASH/extension-id
  • open a file => 🐛 it prints a path like undefined/extension-id, it should just print undefined
export function activate(context: vscode.ExtensionContext) {
    console.log(context.storagePath);
}

jrieken added a commit that referenced this issue Dec 13, 2016
jrieken added a commit that referenced this issue Dec 13, 2016
jrieken added a commit that referenced this issue Dec 13, 2016
jrieken added a commit that referenced this issue Dec 13, 2016
@jrieken jrieken closed this as completed Dec 13, 2016
@fbricon
Copy link
Contributor Author

fbricon commented Dec 13, 2016

So I think this narrows it down to:

1 - open a folder containing a java project, storagepath is set
2 - while vscode is opened, open a separate, standalone file from another folder
3 - close and reopen vscode
4 - both the standalone file and the project folder are reopened, but the standalone file takes precedence somehow and an undefined storagePath is returned.

@fbricon
Copy link
Contributor Author

fbricon commented Dec 13, 2016

So what I'm expecting is if you're opening multiple standalone files and a folder, the storagepath of the folder should be returned.

I don't think you can have 2 folders opened at the same time

@fbricon
Copy link
Contributor Author

fbricon commented Dec 13, 2016

If ^^ is not possible directly from vscode/storagePath then, is there a way, from an extension perspective, to determine what files/folders are opened during activation, so we can compute the appropriate workspace ourself?

@jrieken
Copy link
Member

jrieken commented Dec 13, 2016

Each VS Code window is independent and has its own 'scope'. Wrt the storagePath the rules are that when a folder has been opened it is defined, and in case of a file it is undefined

@dbaeumer dbaeumer added the verified Verification succeeded label Dec 14, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants