Skip to content

Commit 25a8dd4

Browse files
authored
enable markdown language server for prompt files (microsoft#252656)
1 parent b9558f6 commit 25a8dd4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

extensions/markdown-language-features/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
],
1818
"activationEvents": [
1919
"onLanguage:markdown",
20+
"onLanguage:prompt",
21+
"onLanguage:instructions",
22+
"onLanguage:chatmode",
2023
"onCommand:markdown.api.render",
2124
"onCommand:markdown.api.reloadPlugins",
2225
"onWebviewPanel:markdown.preview"

extensions/markdown-language-features/src/client/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
77
import { BaseLanguageClient, LanguageClientOptions, NotebookDocumentSyncRegistrationType, Range, TextEdit } from 'vscode-languageclient';
88
import { IMdParser } from '../markdownEngine';
99
import { IDisposable } from '../util/dispose';
10-
import { looksLikeMarkdownPath, markdownFileExtensions } from '../util/file';
10+
import { looksLikeMarkdownPath, markdownFileExtensions, markdownLanguageIds } from '../util/file';
1111
import { FileWatcherManager } from './fileWatchingManager';
1212
import { InMemoryDocument } from './inMemoryDocument';
1313
import * as proto from './protocol';
@@ -60,7 +60,7 @@ export async function startClient(factory: LanguageClientConstructor, parser: IM
6060
const mdFileGlob = `**/*.{${markdownFileExtensions.join(',')}}`;
6161

6262
const clientOptions: LanguageClientOptions = {
63-
documentSelector: [{ language: 'markdown' }],
63+
documentSelector: markdownLanguageIds,
6464
synchronize: {
6565
configurationSection: ['markdown'],
6666
fileEvents: vscode.workspace.createFileSystemWatcher(mdFileGlob),

extensions/markdown-language-features/src/util/file.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ export const markdownFileExtensions = Object.freeze<string[]>([
1919
'workbook',
2020
]);
2121

22+
export const markdownLanguageIds = ['markdown', 'prompt', 'instructions', 'chatmode'];
23+
2224
export function isMarkdownFile(document: vscode.TextDocument) {
23-
return document.languageId === 'markdown';
25+
return markdownLanguageIds.indexOf(document.languageId) !== -1;
2426
}
2527

2628
export function looksLikeMarkdownPath(resolvedHrefPath: vscode.Uri): boolean {

0 commit comments

Comments
 (0)