Skip to content

Reference a fixed JSON file #42

Discussion options

You must be logged in to vote

I suppose you are looking for customizing the parseTree function, which in that sample, is responsible to load the JSON file from the active editor, as you can see:

	private parseTree(): void {
		this.text = '';
		this.tree = null;
		this.editor = vscode.window.activeTextEditor;
		if (this.editor && this.editor.document) {
			this.text = this.editor.document.getText();  <<-- HERE
			this.tree = json.parseTree(this.text);
		}
	}

https://github.com/microsoft/vscode-extension-samples/blob/128179bd61c0e0a24322ea42d2003b6ace5bc94e/tree-view-sample/src/jsonOutline.ts#L81-L89

In your case, line 86 it the one responsible for that. Replace it with your custom JSON file and you are good to go.

Hop…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by digitarald
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants