-
Notifications
You must be signed in to change notification settings - Fork 29
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 "show toast on new install" logic #4024
Conversation
@@ -1,4 +1,4 @@ | |||
import { commands, env, ExtensionContext, ViewColumn } from 'vscode' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #3994 (comment), we shouldn't be using env in the scenario.
@@ -1,9 +1,15 @@ | |||
import { commands, Memento } from 'vscode' | |||
|
|||
export const resetPersistedState = async (workspaceState: Memento) => { | |||
export const resetPersistedState = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated our resetPersistedState
to include the global state since it is a form of persisted state. Helps with testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Q] Are we sure that all of the keys under here only relate to our extension?
|
||
// old users won't have the installedKey even if it's not a new install | ||
const workspaceKeys = workspaceState.keys() | ||
return showSetupToast(workspaceKeys.length === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check for workspaceKeys length since an old user will have these set. I suppose we could take off this extra check in about a month like we've done in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Q] Same question. Are you sure everything in the workspaceState only relates to our extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that workspaceState
and globalState
both relate only to our extension since looking at the docs for ExtensionContext
:
* An extension context is a collection of utilities private to an
* extension.
Plus I was console logging both states before I touched anything. globalState
was completely empty and workspaceState
only had keys set by our extension.
Code Climate has analyzed commit 47418c7 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 90.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.2% (0.0% change). View more on Code Climate. |
Demo
I tested locally and on codespaces. Note that global extension state stays even after you uninstall the extension.
local.mov
Resolves #3994 (comment)