Skip to content

Commit 1a6cd33

Browse files
authored
fix(vscode): improve handling of uris (#4440)
1 parent 9b98ac4 commit 1a6cd33

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode/extension/src/webviews/lineagePanel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class LineagePanel implements WebviewViewProvider, Disposable {
3131
key: 'vscode_send',
3232
payload: {
3333
key: 'savedFile',
34-
payload: { fileUri: document.uri.fsPath },
34+
payload: { fileUri: document.uri.toString() },
3535
},
3636
})
3737
})
@@ -42,7 +42,7 @@ export class LineagePanel implements WebviewViewProvider, Disposable {
4242
key: 'vscode_send',
4343
payload: {
4444
key: 'changeFocusOnFile',
45-
payload: { path: editor.document.uri.fsPath },
45+
payload: { path: editor.document.uri.toString() },
4646
},
4747
})
4848
}

vscode/react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"react-dom": "^18.2.0",
3232
"react-router": "^7.0.0",
3333
"reactflow": "^11.8.3",
34-
"tailwindcss": "^4.1.3"
34+
"tailwindcss": "^4.1.3",
35+
"vscode-uri": "^3.1.0"
3536
},
3637
"devDependencies": {
3738
"@testing-library/dom": "^10.4.0",

vscode/react/src/pages/lineage.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import React, { useState } from 'react'
1313
import { ModelSQLMeshModel } from '@/domain/sqlmesh-model'
1414
import { useEventBus } from '@/hooks/eventBus'
1515
import type { VSCodeEvent } from '@bus/callbacks'
16+
import { URI } from 'vscode-uri'
1617

1718
export function LineagePage() {
1819
const { emit } = useEventBus()
@@ -97,10 +98,7 @@ function Lineage() {
9798
)
9899
const selectedModel = selectedModelSet
99100
on('changeFocusedFile', fileUri => {
100-
console.log('on changeFocusedFile', fileUri)
101-
const full_path = fileUri.fileUri.startsWith('file://')
102-
? fileUri.fileUri.substring(7)
103-
: fileUri.fileUri
101+
const full_path = URI.parse(fileUri.fileUri).fsPath
104102
const model = Object.values(modelsRecord).find(
105103
(m: Model) => m.full_path === full_path,
106104
)
@@ -135,7 +133,7 @@ export function LineageComponentFromWeb({
135133
if (!model) {
136134
throw new Error('Model not found')
137135
}
138-
vscode('openFile', { uri: 'file://' + model.full_path })
136+
vscode('openFile', { uri: URI.file(model.full_path).toString() })
139137
}
140138

141139
function handleError(error: any): void {

0 commit comments

Comments
 (0)