Skip to content

Commit a45fa6e

Browse files
authored
Use @example tags in vscode.d.ts (#106352)
`@example` is the standard way to document code examples. This also gets us syntax highlighting of code examples in hovers
1 parent ad451c4 commit a45fa6e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/vs/vscode.d.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,8 @@ declare module 'vscode' {
14751475
* A function that represents an event to which you subscribe by calling it with
14761476
* a listener function as argument.
14771477
*
1478-
* @sample `item.onDidChange(function(event) { console.log("Event happened: " + event); });`
1478+
* @example
1479+
* item.onDidChange(function(event) { console.log("Event happened: " + event); });
14791480
*/
14801481
export interface Event<T> {
14811482

@@ -1920,8 +1921,11 @@ declare module 'vscode' {
19201921
* the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of
19211922
* its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).
19221923
*
1923-
* @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
1924-
* @sample A language filter that applies to all package.json paths: `{ language: 'json', scheme: 'untitled', pattern: '**​/package.json' }`
1924+
* @example <caption>A language filter that applies to typescript files on disk</caption>
1925+
* { language: 'typescript', scheme: 'file' }
1926+
*
1927+
* @example <caption>A language filter that applies to all package.json paths</caption>
1928+
* { language: 'json', scheme: 'untitled', pattern: '**​/package.json' }
19251929
*/
19261930
export interface DocumentFilter {
19271931

@@ -1951,7 +1955,8 @@ declare module 'vscode' {
19511955
* a feature works without further context, e.g. without the need to resolve related
19521956
* 'files'.
19531957
*
1954-
* @sample `let sel:DocumentSelector = { scheme: 'file', language: 'typescript' }`;
1958+
* @example
1959+
* let sel:DocumentSelector = { scheme: 'file', language: 'typescript' };
19551960
*/
19561961
export type DocumentSelector = DocumentFilter | string | Array<DocumentFilter | string>;
19571962

@@ -9724,7 +9729,9 @@ declare module 'vscode' {
97249729
/**
97259730
* Find files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
97269731
*
9727-
* @sample `findFiles('**​/*.js', '**​/node_modules/**', 10)`
9732+
* @example
9733+
* findFiles('**​/*.js', '**​/node_modules/**', 10)
9734+
*
97289735
* @param include A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern
97299736
* will be matched against the file paths of resulting matches relative to their workspace. Use a [relative pattern](#RelativePattern)
97309737
* to restrict the search results to a [workspace folder](#WorkspaceFolder).

0 commit comments

Comments
 (0)