Doc Symbols proper support
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
Event,
|
||||
EventEmitter,
|
||||
ProviderResult,
|
||||
TextDocument
|
||||
TextDocument,
|
||||
Uri
|
||||
} from "vscode";
|
||||
import {HighlightParams, toVSRange} from './highlight-service';
|
||||
import * as Lsp from 'vscode-languageclient';
|
||||
@@ -22,7 +23,7 @@ export class HighlightCodeLensProvider implements CodeLensProvider {
|
||||
|
||||
handle(highlghtParams: HighlightParams) {
|
||||
if (!deepEqual(this.highlights.get(highlghtParams.doc.uri), highlghtParams)) {
|
||||
this.highlights.set(highlghtParams.doc.uri, highlghtParams);
|
||||
this.highlights.set(Uri.parse(highlghtParams.doc.uri).toString(), highlghtParams);
|
||||
this._onDidChangeCodeLenses.fire();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export class HighlightService {
|
||||
}
|
||||
|
||||
handle(params : HighlightParams) : void {
|
||||
this.highlights.set(params.doc.uri, params);
|
||||
this.highlights.set(VSCode.Uri.parse(params.doc.uri).toString(), params);
|
||||
this.refresh(params.doc);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export class HighlightService {
|
||||
for (let editor of editors) {
|
||||
const activeUri = editor.document.uri.toString();
|
||||
const activeVersion = editor.document.version;
|
||||
if (docId.uri === activeUri && docId.version === activeVersion) {
|
||||
if (VSCode.Uri.parse(docId.uri).toString() === activeUri && docId.version === activeVersion) {
|
||||
//We only update highlights in the active editor for now
|
||||
this.updateHighlightsForEditor(editor);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import * as OS from "os";
|
||||
import * as VSCode from 'vscode';
|
||||
import { workspace } from 'vscode';
|
||||
|
||||
@@ -44,6 +45,30 @@ export function activate(context: VSCode.ExtensionContext): Thenable<LanguageCli
|
||||
},
|
||||
workspaceOptions: VSCode.workspace.getConfiguration("spring-boot.ls"),
|
||||
clientOptions: {
|
||||
uriConverters: {
|
||||
code2Protocol: (uri) => {
|
||||
/*
|
||||
* Workaround for docUri coming from vscode-languageclient on Windows
|
||||
*
|
||||
* It comes in as "file:///c%3A/Users/ab/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
|
||||
*
|
||||
* While symbols index would have this uri instead:
|
||||
* - "file:///C:/Users/ab/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java"
|
||||
*
|
||||
* i.e. lower vs upper case drive letter and escaped drive colon
|
||||
*/
|
||||
if (OS.platform() === "win32" && uri.scheme === 'file') {
|
||||
let uriStr = uri.toString(true);
|
||||
const idx = uriStr.indexOf(':', 5);
|
||||
if (idx > 5 && idx < 10) {
|
||||
uriStr = `${uriStr.substring(0, idx - 1)}${uriStr.charAt(idx - 1).toUpperCase()}${uriStr.substring(idx)}`
|
||||
}
|
||||
return uriStr;
|
||||
}
|
||||
return uri.toString();
|
||||
},
|
||||
protocol2Code: uri => VSCode.Uri.file(uri)
|
||||
},
|
||||
// See PT-158992999 as to why a scheme is added to the document selector
|
||||
// documentSelector: [ PROPERTIES_LANGUAGE_ID, YAML_LANGUAGE_ID, JAVA_LANGUAGE_ID ],
|
||||
documentSelector: [
|
||||
|
||||
Reference in New Issue
Block a user