mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
parent
f941ff6566
commit
b11bb04298
|
@ -566,6 +566,12 @@
|
|||
"tags": [
|
||||
"experimental"
|
||||
]
|
||||
},
|
||||
"markdown.occurrencesHighlight.enabled": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%configuration.markdown.occurrencesHighlight.enabled%",
|
||||
"scope": "resource"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
"configuration.markdown.updateLinksOnFileMove.enabled.always": "Always update links automatically.",
|
||||
"configuration.markdown.updateLinksOnFileMove.enabled.never": "Never try to update link and don't prompt.",
|
||||
"configuration.markdown.updateLinksOnFileMove.fileGlobs": "A glob that specifies which files besides markdown should trigger a link update.",
|
||||
"configuration.markdown.updateLinksOnFileMove.enableForDirectories": "enable/disable updating links when a directory is moved or renamed in the workspace.",
|
||||
"configuration.markdown.updateLinksOnFileMove.enableForDirectories": "Enable/disable updating links when a directory is moved or renamed in the workspace.",
|
||||
"configuration.markdown.occurrencesHighlight.enabled": "Enable/disable highlighting link occurrences in the current document.",
|
||||
"workspaceTrust": "Required for loading styles configured in the workspace."
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"vscode-languageserver": "^8.0.2",
|
||||
"vscode-languageserver-textdocument": "^1.0.5",
|
||||
"vscode-languageserver-types": "^3.17.1",
|
||||
"vscode-markdown-languageservice": "^0.2.0-alpha.2",
|
||||
"vscode-markdown-languageservice": "^0.2.0-alpha.3",
|
||||
"vscode-nls": "^5.2.0",
|
||||
"vscode-uri": "^3.0.3"
|
||||
},
|
||||
|
|
|
@ -10,6 +10,10 @@ export type ValidateEnabled = 'ignore' | 'warning' | 'error' | 'hint';
|
|||
|
||||
interface Settings {
|
||||
readonly markdown: {
|
||||
readonly occurrencesHighlight: {
|
||||
readonly enabled: boolean;
|
||||
};
|
||||
|
||||
readonly suggest: {
|
||||
readonly paths: {
|
||||
readonly enabled: boolean;
|
||||
|
|
|
@ -79,6 +79,7 @@ export async function startServer(connection: Connection, serverConfig: {
|
|||
});
|
||||
|
||||
registerCompletionsSupport(connection, documents, mdLs, configurationManager);
|
||||
registerDocumentHightlightSupport(connection, documents, mdLs, configurationManager);
|
||||
registerValidateSupport(connection, workspace, documents, mdLs, configurationManager, serverConfig.logger);
|
||||
|
||||
return {
|
||||
|
@ -93,7 +94,7 @@ export async function startServer(connection: Connection, serverConfig: {
|
|||
completionProvider: { triggerCharacters: ['.', '/', '#'] },
|
||||
definitionProvider: true,
|
||||
documentLinkProvider: { resolveProvider: true },
|
||||
documentHighlightProvider: false, // TODO: Disabling for now
|
||||
documentHighlightProvider: true,
|
||||
documentSymbolProvider: true,
|
||||
foldingRangeProvider: true,
|
||||
referencesProvider: true,
|
||||
|
@ -233,14 +234,6 @@ export async function startServer(connection: Connection, serverConfig: {
|
|||
return codeAction;
|
||||
});
|
||||
|
||||
connection.onDocumentHighlight(async (params, token) => {
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (!document) {
|
||||
return undefined;
|
||||
}
|
||||
return mdLs!.getDocumentHighlights(document, params.position, token);
|
||||
});
|
||||
|
||||
connection.onRequest(protocol.getReferencesToFileInWorkspace, (async (params: { uri: string }, token: CancellationToken) => {
|
||||
return mdLs!.getFileReferences(URI.parse(params.uri), token);
|
||||
}));
|
||||
|
@ -308,3 +301,24 @@ function registerCompletionsSupport(
|
|||
update();
|
||||
return config.onDidChangeConfiguration(() => update());
|
||||
}
|
||||
|
||||
function registerDocumentHightlightSupport(
|
||||
connection: Connection,
|
||||
documents: TextDocuments<md.ITextDocument>,
|
||||
mdLs: md.IMdLanguageService,
|
||||
configurationManager: ConfigurationManager
|
||||
) {
|
||||
connection.onDocumentHighlight(async (params, token) => {
|
||||
const settings = configurationManager.getSettings();
|
||||
if (!settings?.markdown.occurrencesHighlight.enabled) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const document = documents.get(params.textDocument.uri);
|
||||
if (!document) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return mdLs!.getDocumentHighlights(document, params.position, token);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ vscode-languageserver@^8.0.2:
|
|||
dependencies:
|
||||
vscode-languageserver-protocol "3.17.2"
|
||||
|
||||
vscode-markdown-languageservice@^0.2.0-alpha.2:
|
||||
version "0.2.0-alpha.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.2.0-alpha.2.tgz#ed08bc3f7f19c5fb0283547a7855542224ce377c"
|
||||
integrity sha512-2/Mp/b63ohC8k0h1boWohf2G6SwLb3IA+c3UcqPs4FdaRpGqpf2wVXaT5aQ5qVRGpqvCwfyyyr2YEdqwuQc5KA==
|
||||
vscode-markdown-languageservice@^0.2.0-alpha.3:
|
||||
version "0.2.0-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.2.0-alpha.3.tgz#5bc3934ebb97ce855f49fbb345a5e1f5ace7d660"
|
||||
integrity sha512-3ikmh1Mcr9s5s0wZZsxb7heSzKooudCgtZzL5d8t94WDbg02u9i2cDYF6qufK6Og5pBSC3ajeF12qFAYbRIbgQ==
|
||||
dependencies:
|
||||
picomatch "^2.3.1"
|
||||
vscode-languageserver-textdocument "^1.0.5"
|
||||
|
|
Loading…
Reference in a new issue