update to work with lsp definition format
parent
b21c42e638
commit
acbc5a203f
14
src/index.ts
14
src/index.ts
|
@ -21,7 +21,8 @@ import {
|
||||||
import {
|
import {
|
||||||
LanguageClient,
|
LanguageClient,
|
||||||
LanguageClientOptions,
|
LanguageClientOptions,
|
||||||
TransportKind
|
TransportKind,
|
||||||
|
Location
|
||||||
} from 'vscode-languageclient'
|
} from 'vscode-languageclient'
|
||||||
|
|
||||||
import { createTreeView } from './treeView'
|
import { createTreeView } from './treeView'
|
||||||
|
@ -137,11 +138,14 @@ export async function activate(context: ExtensionContext) {
|
||||||
})
|
})
|
||||||
client.onNotification(
|
client.onNotification(
|
||||||
'tailwindcss/foundDefinition',
|
'tailwindcss/foundDefinition',
|
||||||
(configPath, pos) => {
|
({ uri, range }: Location) => {
|
||||||
Workspace.openTextDocument(configPath).then((doc: TextDocument) => {
|
Workspace.openTextDocument(uri.replace(/^file:\/\//, '')).then((doc: TextDocument) => {
|
||||||
Window.showTextDocument(doc).then((editor: TextEditor) => {
|
Window.showTextDocument(doc).then((editor: TextEditor) => {
|
||||||
let start = new Position(pos.start.line, pos.start.character)
|
let start = new Position(
|
||||||
let end = new Position(pos.end.line, pos.end.character)
|
range.start.line,
|
||||||
|
range.start.character
|
||||||
|
)
|
||||||
|
let end = new Position(range.end.line, range.end.character)
|
||||||
editor.revealRange(
|
editor.revealRange(
|
||||||
new Range(start, end),
|
new Range(start, end),
|
||||||
TextEditorRevealType.InCenter
|
TextEditorRevealType.InCenter
|
||||||
|
|
Loading…
Reference in New Issue