JSDoc for vscode.d.ts

This commit is contained in:
Alex Dima 2015-11-17 14:35:10 +01:00
parent 922b2b2088
commit 823f12503f

91
src/vs/vscode.d.ts vendored
View file

@ -1981,30 +1981,85 @@ declare namespace vscode {
blockComment?: CharacterPair; blockComment?: CharacterPair;
} }
/**
* Describes indentation rules for a language.
*/
export interface IndentationRule { export interface IndentationRule {
/**
* If a line matches this pattern, then all the lines after it should be unindendented once (until another rule matches).
*/
decreaseIndentPattern: RegExp; decreaseIndentPattern: RegExp;
/**
* If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
*/
increaseIndentPattern: RegExp; increaseIndentPattern: RegExp;
/**
* If a line matches this pattern, then **only the next line** after it should be indented once.
*/
indentNextLinePattern?: RegExp; indentNextLinePattern?: RegExp;
/**
* If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
*/
unIndentedLinePattern?: RegExp; unIndentedLinePattern?: RegExp;
} }
// <<< this is not an 'action' but an 'indent type' /**
* Describes what to do with the indentation when pressing Enter.
*/
export enum IndentAction { export enum IndentAction {
/**
* Insert new line and copy the previous line's indentation.
*/
None, None,
/**
* Insert new line and indent once (relative to the previous line's indentation).
*/
Indent, Indent,
/**
* Insert two new lines:
* - the first one indented which will hold the cursor
* - the second one at the same indentation level
*/
IndentOutdent, IndentOutdent,
/**
* Insert new line and outdent once (relative to the previous line's indentation).
*/
Outdent Outdent
} }
/**
* Describes what to do when pressing Enter.
*/
export interface EnterAction { export interface EnterAction {
indentAction: IndentAction; // <<< confusing: another reason not to use the name 'IndentAction' >>> /**
* Describe what to do with the indentation.
*/
indentAction: IndentAction;
/**
* Describes text to be appended after the new line and after the indentation.
*/
appendText?: string; appendText?: string;
removeText?: number; // <<< non-obvious: the number of characters to remove? >>> /**
* Describes the number of characters to remove from the new line's indentation.
*/
removeText?: number;
} }
/**
* Describes a rule to be evaluated when pressing Enter.
*/
export interface OnEnterRule { export interface OnEnterRule {
/**
* This rule will only execute if the text before the cursor matches this regular expression.
*/
beforeText: RegExp; beforeText: RegExp;
/**
* This rule will only execute if the text after the cursor matches this regular expression.
*/
afterText?: RegExp; afterText?: RegExp;
/**
* The action to execute.
*/
action: EnterAction; action: EnterAction;
} }
@ -2013,13 +2068,34 @@ declare namespace vscode {
* and various editor feature, like automatic bracket insertion, automatic indentation etc. * and various editor feature, like automatic bracket insertion, automatic indentation etc.
*/ */
export interface LanguageConfiguration { export interface LanguageConfiguration {
/**
* The language's comment settings.
*/
comments?: CommentRule; comments?: CommentRule;
/**
* The language's brackets.
* This configuration implicitly affects pressing Enter around these brackets.
*/
brackets?: CharacterPair[]; brackets?: CharacterPair[];
/**
* The language's word definition.
* If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
* to provide a word definition that uses exclusion of known separators.
* e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
* /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
*/
wordPattern?: RegExp; wordPattern?: RegExp;
/**
* The language's indentation settings.
*/
indentationRules?: IndentationRule; indentationRules?: IndentationRule;
/**
* The language's rules to be evaluated when pressing Enter.
*/
onEnterRules?: OnEnterRule[]; onEnterRules?: OnEnterRule[];
/** /**
* **Deprecated** Do not use.
* *
* @deprecated Will be replaced by a better API soon. * @deprecated Will be replaced by a better API soon.
*/ */
@ -2031,14 +2107,15 @@ declare namespace vscode {
isElectric: boolean; isElectric: boolean;
}[]; }[];
docComment?: { docComment?: {
scope: string; // What tokens should be used to detect a doc comment (e.g. 'comment.documentation'). scope: string;
open: string; // The string that starts a doc comment (e.g. '/**') open: string;
lineStart: string; // The string that appears at the start of each line, except the first and last (e.g. ' * '). lineStart: string;
close?: string; // The string that appears on the last line and closes the doc comment (e.g. ' */'). close?: string;
}; };
}; };
/** /**
* **Deprecated** Do not use.
* *
* @deprecated Will be replaced by a better API soon. * @deprecated Will be replaced by a better API soon.
*/ */