Skip to content

Commit 4bf6033

Browse files
authored
Add supportThemeIcons in MarkdownString (#1504)
1 parent 5393301 commit 4bf6033

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

client-node-tests/src/converter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as async from 'vscode-languageclient/$test/common/utils/async';
1717
import * as vscode from 'vscode';
1818

1919
const c2p: codeConverter.Converter = codeConverter.createConverter();
20-
const p2c: protocolConverter.Converter = protocolConverter.createConverter(undefined, false, false);
20+
const p2c: protocolConverter.Converter = protocolConverter.createConverter(undefined, false, false, false);
2121

2222
interface InsertReplaceRange {
2323
inserting: vscode.Range;
@@ -1214,7 +1214,7 @@ suite('Protocol Converter', () => {
12141214
test('Uri Rewrite', () => {
12151215
const converter = protocolConverter.createConverter((value: string) => {
12161216
return vscode.Uri.parse(`${value}.vscode`);
1217-
}, false, false);
1217+
}, false, false, false);
12181218

12191219
const result = converter.asUri('file://localhost/folder/file');
12201220
strictEqual('file://localhost/folder/file.vscode', result.toString());

client/src/common/client.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export type LanguageClientOptions = {
371371
markdown?: {
372372
isTrusted?: boolean | { readonly enabledCommands: readonly string[] };
373373
supportHtml?: boolean;
374+
supportThemeIcons?: boolean;
374375
};
375376
} & $NotebookDocumentOptions & $DiagnosticPullOptions & $ConfigurationOptions;
376377

@@ -403,6 +404,7 @@ type ResolvedClientOptions = {
403404
markdown: {
404405
isTrusted: boolean | { readonly enabledCommands: readonly string[] };
405406
supportHtml: boolean;
407+
supportThemeIcons: boolean;
406408
};
407409
} & Required<$NotebookDocumentOptions> & Required<$DiagnosticPullOptions>;
408410
namespace ResolvedClientOptions {
@@ -534,10 +536,15 @@ export abstract class BaseLanguageClient implements FeatureClient<Middleware, La
534536

535537
clientOptions = clientOptions || {};
536538

537-
const markdown: ResolvedClientOptions['markdown'] = { isTrusted: false, supportHtml: false };
539+
const markdown: ResolvedClientOptions['markdown'] = {
540+
isTrusted: false,
541+
supportHtml: false,
542+
supportThemeIcons: false
543+
};
538544
if (clientOptions.markdown !== undefined) {
539545
markdown.isTrusted = ResolvedClientOptions.sanitizeIsTrusted(clientOptions.markdown.isTrusted);
540546
markdown.supportHtml = clientOptions.markdown.supportHtml === true;
547+
markdown.supportThemeIcons = clientOptions.markdown.supportThemeIcons === true;
541548
}
542549

543550
// const defaultInterval = (clientOptions as TestOptions).$testMode ? 50 : 60000;
@@ -618,7 +625,8 @@ export abstract class BaseLanguageClient implements FeatureClient<Middleware, La
618625
this._p2c = p2c.createConverter(
619626
clientOptions.uriConverters ? clientOptions.uriConverters.protocol2Code : undefined,
620627
this._clientOptions.markdown.isTrusted,
621-
this._clientOptions.markdown.supportHtml);
628+
this._clientOptions.markdown.supportHtml,
629+
this._clientOptions.markdown.supportThemeIcons);
622630
this._syncedDocuments = new Map<string, TextDocument>();
623631
this.registerBuiltinFeatures();
624632
}

client/src/common/protocolConverter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ namespace CodeBlock {
276276
}
277277
}
278278

279-
export function createConverter(uriConverter: URIConverter | undefined, trustMarkdown: boolean | { readonly enabledCommands: readonly string[] }, supportHtml: boolean): Converter {
279+
export function createConverter(
280+
uriConverter: URIConverter | undefined,
281+
trustMarkdown: boolean | { readonly enabledCommands: readonly string[] },
282+
supportHtml: boolean,
283+
supportThemeIcons: boolean): Converter {
280284

281285
const nullConverter = (value: string) => code.Uri.parse(value);
282286

@@ -481,6 +485,7 @@ export function createConverter(uriConverter: URIConverter | undefined, trustMar
481485
}
482486
result.isTrusted = trustMarkdown;
483487
result.supportHtml = supportHtml;
488+
result.supportThemeIcons = supportThemeIcons;
484489
return result;
485490
}
486491

0 commit comments

Comments
 (0)