Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hood committed Mar 13, 2024
1 parent e4f081f commit 6477995
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ This extension is intended to assist in the development and testing of those Jso
- **Jsonnet Language Support** provides basic Jsonnet language support including colorization, syntax highlighting and semantic tokens for the Standard and additional Functions libraries.
- **Code completion** provides snippets and context sensitive help for the Standard and additional Functions libraries.
- **Document Formatting** using the [go-jsonnet](https://pkg.go.dev/github.com/google/go-jsonnet) formatter with its default options.
- **Snapshots** allow a point in time copy of a playground to be taken.
- **Snapshots** allow point in time copies of a playground to be taken.
- **Import and Export** of Playgrounds in JSON format for collaboration and sharing. Playground files are compatible with the [Data Transformer Web Application](https://datatransformer-playground.web.app).
- **Tracing** support for the `std.trace()` function, with the trace output copied to the Data Transformer Output window.

## Requirements

The Data Transformer Playground requires internet access to the Data Transformer Playground server URL - default https://datatransformer-playground.web.app.
The Data Transformer Playground requires internet access to the Data Transformer Playground server at https://datatransformer-playground.web.app.

Playgrounds, scripts and variables defintions are stored in a local, workspace specific, storage location where the extension has read/write access. By default, this is the location defined by the Workspace's ExtensionContext.storageUri setting. Please see the Visual Studio Code documentation for [Data Storage](https://code.visualstudio.com/api/extension-capabilities/common-capabilities#data-storage) for more information.

Expand Down
2 changes: 1 addition & 1 deletion src/PlaygroundsTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export class PlaygroundsTreeDataProvider
const index = tabs.findIndex(
(tab) =>
tab.input instanceof vscode.TabInputText &&
tab.input.uri.path === file.path,
tab.input.uri.path.toLowerCase() === file.path.toLowerCase(),
);
if (index !== -1) {
await vscode.window.tabGroups.close(tabs[index]);
Expand Down
11 changes: 9 additions & 2 deletions src/ScriptsTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ export class ScriptsTreeDataProvider
getActiveOrDefault(uri: vscode.Uri): ScriptsTreeItem {
console.log("getDefault", uri, this.data);

return this.data.find((item) => item.uri.path === uri.path) || this.data[0];
if (!uri) {
return this.data[0];
}
return (
this.data.find(
(item) => item.uri.path.toLowerCase() === uri.path.toLowerCase(),
) || this.data[0]
);
}

getTreeItem(
Expand Down Expand Up @@ -121,7 +128,7 @@ export class ScriptsTreeDataProvider
const index = tabs.findIndex(
(tab) =>
tab.input instanceof vscode.TabInputText &&
tab.input.uri.path === file.path,
tab.input.uri.path.toLowerCase() === file.path.toLowerCase(),
);
if (index !== -1) {
await vscode.window.tabGroups.close(tabs[index]);
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function activate(context: vscode.ExtensionContext) {
setTimeout(
() =>
scriptsTreeView.reveal(
scriptsTreeDataProvider.getActiveOrDefault(editor.document.uri),
scriptsTreeDataProvider.getActiveOrDefault(editor?.document.uri),
{
select: true,
},
Expand Down Expand Up @@ -206,7 +206,7 @@ export function activate(context: vscode.ExtensionContext) {
);

scriptsTreeView.reveal(
scriptsTreeDataProvider.getActiveOrDefault(editor.document.uri),
scriptsTreeDataProvider.getActiveOrDefault(editor?.document.uri),
{
select: true,
},
Expand Down

0 comments on commit 6477995

Please sign in to comment.