Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97313

VSCode - getConfiguration() Returning Cache Value?

$
0
0

An extension I'm writing has a single value in it's Contributes section like this:

"main": "./out/extension.js",
  "contributes": {
    "configuration": {
      "title": "My Extension Features",
      "properties": {
        "myextension.extensionStore": {
          "type": "string",
          "default": "C:\\Users\\SomeUser\\Desktop\\ExtensionStore"
        }
      }
    },

In one of my classes that extends TreeDataMenuProvider we'll call GreatMenuProvider, when it is instantiated does the following:

export class GreatMenuProvider implements vscode.TreeDataProvider<GreatMenuItem> {

  _extensionStore: any = vscode.workspace
    .getConfiguration("myextension")
    .get("extensionStore");

// ...remainder of the implementation that builds the tree view I want, which worked until later

}

export class GreatMenuItem extends vscode.TreeItem {
  constructor(
    public readonly label: string,
    public readonly collapsibleState: vscode.TreeItemCollapsibleState,
    public uri: vscode.Uri,
    public type: vscode.FileType,
    public iconPath,
    public version: string | number,
    public children?: GreatMenuItem[],
    public readonly comand?: vscode.Command
  ) {
    super(label, collapsibleState);
  }

  setIcons() {
    this.iconPath = {
      light: path.join(
        myUtils.getExtensionResourcesDir(),
        "light",
        "doc-text-inv.svg"
      ),
      dark: path.join(
        myUtils.getExtensionResourcesDir(),
        "dark",
        "doc-text.svg"
      )
    };
  }
}

In doing some testing against fake or inaccessible paths, I changed the value of myextension.extensionStore to something else, which failed as expected in the check in my implementation.

However, even though I can change the value listed in the default key for .extensionStore, no matter what I set it to, the old value continues to get picked up when I run my extension to debug.

Since it looks for icons, I have a working version installed, and the error does not occur, so something cached the fake/old value. The fake value is nowhere in my code now, but continues to show up every time I run this.

I thought I had this solved by deleting my ./out folder, turning on watch in my tsconfig.json, but still keeps showing up.

Stepped through alot of extensionHostProcess.js but couldn't figure out where or how it's finding the old value.

What else in a VS Code extension could cache this if it's not anywhere in my Typescript files?

Also I've tried changing to numerous different commit hashes, and no matter what the problem persists. Also tried deleting all kinds of stuff out of %AppData%/Code which didn't work either.

UPDATE: Eventually I just nuked my entire %AppData%/Code folder, and now it works again. I don't know whether it was one of the .vscdb files, stuff from backups, or otherwise, but don't know what files or combination of them persisted that nagging piece of bad info.

Oh well!


Viewing all articles
Browse latest Browse all 97313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>