Skip to content

Commit acbc5a2

Browse files
committed
update to work with lsp definition format
1 parent b21c42e commit acbc5a2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
import {
2222
LanguageClient,
2323
LanguageClientOptions,
24-
TransportKind
24+
TransportKind,
25+
Location
2526
} from 'vscode-languageclient'
2627

2728
import { createTreeView } from './treeView'
@@ -137,11 +138,14 @@ export async function activate(context: ExtensionContext) {
137138
})
138139
client.onNotification(
139140
'tailwindcss/foundDefinition',
140-
(configPath, pos) => {
141-
Workspace.openTextDocument(configPath).then((doc: TextDocument) => {
141+
({ uri, range }: Location) => {
142+
Workspace.openTextDocument(uri.replace(/^file:\/\//, '')).then((doc: TextDocument) => {
142143
Window.showTextDocument(doc).then((editor: TextEditor) => {
143-
let start = new Position(pos.start.line, pos.start.character)
144-
let end = new Position(pos.end.line, pos.end.character)
144+
let start = new Position(
145+
range.start.line,
146+
range.start.character
147+
)
148+
let end = new Position(range.end.line, range.end.character)
145149
editor.revealRange(
146150
new Range(start, end),
147151
TextEditorRevealType.InCenter

0 commit comments

Comments
 (0)