This commit is contained in:
Garrett Campbell 2024-05-09 14:25:15 -04:00
Родитель 77f3b94f2d
Коммит a5453f8f29
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -4,6 +4,7 @@ import { CancellationToken, MarkdownString, MarkedString } from 'vscode';
const fs = require('fs');
import * as util from '@cmt/util';
import { getExtensionLocalizedStrings } from './extension';
import { Mark } from 'js-yaml';
// Create a version of fs.readFile that returns a promise
const readFile = promisify(fs.readFile);
@ -68,18 +69,21 @@ export class IntellisenseData {
// Assume that something with syntax examples is a command, otherwise it's a variable
if (syntaxExamples) {
resultStrings.push(description);
const desc: MarkdownString = new MarkdownString(`$(symbol-function) ${description}`, true);
resultStrings.push(desc);
for (const example of syntaxExamples) {
const splitExamples = example.split(`${name}(`);
for (const ex of splitExamples) {
if (ex) {
const hover = { language: "cmake", value: ` ${name}(${ex}` };
resultStrings.push(hover);
const str: MarkdownString = new MarkdownString();
str.appendCodeblock(`${name}(${ex}`, "cmake");
resultStrings.push(str);
}
}
}
} else {
resultStrings.push(name);
const nameMarkdown: MarkdownString = new MarkdownString(`$(symbol-variable) ${name}`, true);
resultStrings.push(nameMarkdown);
resultStrings.push(description);
}