Remove support for @monacodtsreplace
since TS has gotten a lot better at emitting dts
This commit is contained in:
parent
0eaaf654c8
commit
435f287a5c
|
@ -149,26 +149,6 @@ function getMassagedTopLevelDeclarationText(ts, sourceFile, declaration, importN
|
|||
}
|
||||
});
|
||||
}
|
||||
else if (declaration.kind === ts.SyntaxKind.VariableStatement) {
|
||||
const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile));
|
||||
if (jsDoc.indexOf('@monacodtsreplace') >= 0) {
|
||||
const jsDocLines = jsDoc.split(/\r\n|\r|\n/);
|
||||
let directives = [];
|
||||
for (const jsDocLine of jsDocLines) {
|
||||
const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/);
|
||||
if (m) {
|
||||
directives.push([new RegExp(m[1], 'g'), m[2]]);
|
||||
}
|
||||
}
|
||||
// remove the jsdoc
|
||||
result = result.substr(jsDoc.length);
|
||||
if (directives.length > 0) {
|
||||
// apply replace directives
|
||||
const replacer = createReplacerFromDirectives(directives);
|
||||
result = replacer(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
result = result.replace(/declare /g, '');
|
||||
|
|
|
@ -178,25 +178,6 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou
|
|||
// life..
|
||||
}
|
||||
});
|
||||
} else if (declaration.kind === ts.SyntaxKind.VariableStatement) {
|
||||
const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile));
|
||||
if (jsDoc.indexOf('@monacodtsreplace') >= 0) {
|
||||
const jsDocLines = jsDoc.split(/\r\n|\r|\n/);
|
||||
let directives: [RegExp, string][] = [];
|
||||
for (const jsDocLine of jsDocLines) {
|
||||
const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/);
|
||||
if (m) {
|
||||
directives.push([new RegExp(m[1], 'g'), m[2]]);
|
||||
}
|
||||
}
|
||||
// remove the jsdoc
|
||||
result = result.substr(jsDoc.length);
|
||||
if (directives.length > 0) {
|
||||
// apply replace directives
|
||||
const replacer = createReplacerFromDirectives(directives);
|
||||
result = replacer(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
|
|
|
@ -1152,6 +1152,9 @@ export interface IEditorCommentsOptions {
|
|||
ignoreEmptyLines?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorCommentsOptions = Readonly<Required<IEditorCommentsOptions>>;
|
||||
|
||||
class EditorComments extends BaseEditorOption<EditorOption.comments, EditorCommentsOptions> {
|
||||
|
@ -1382,6 +1385,9 @@ export interface IEditorFindOptions {
|
|||
loop?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorFindOptions = Readonly<Required<IEditorFindOptions>>;
|
||||
|
||||
class EditorFind extends BaseEditorOption<EditorOption.find, EditorFindOptions> {
|
||||
|
@ -1634,6 +1640,9 @@ export interface IGotoLocationOptions {
|
|||
alternativeReferenceCommand?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type GoToLocationOptions = Readonly<Required<IGotoLocationOptions>>;
|
||||
|
||||
class EditorGoToLocation extends BaseEditorOption<EditorOption.gotoLocation, GoToLocationOptions> {
|
||||
|
@ -1769,6 +1778,9 @@ export interface IEditorHoverOptions {
|
|||
sticky?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorHoverOptions = Readonly<Required<IEditorHoverOptions>>;
|
||||
|
||||
class EditorHover extends BaseEditorOption<EditorOption.hover, EditorHoverOptions> {
|
||||
|
@ -2390,6 +2402,9 @@ export interface IEditorLightbulbOptions {
|
|||
enabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorLightbulbOptions = Readonly<Required<IEditorLightbulbOptions>>;
|
||||
|
||||
class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, EditorLightbulbOptions> {
|
||||
|
@ -2446,6 +2461,9 @@ export interface IEditorInlayHintsOptions {
|
|||
fontFamily?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorInlayHintsOptions = Readonly<Required<IEditorInlayHintsOptions>>;
|
||||
|
||||
class EditorInlayHints extends BaseEditorOption<EditorOption.inlayHints, EditorInlayHintsOptions> {
|
||||
|
@ -2554,6 +2572,9 @@ export interface IEditorMinimapOptions {
|
|||
scale?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;
|
||||
|
||||
class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimapOptions> {
|
||||
|
@ -2667,10 +2688,10 @@ export interface IEditorPaddingOptions {
|
|||
bottom?: number;
|
||||
}
|
||||
|
||||
export interface InternalEditorPaddingOptions {
|
||||
readonly top: number;
|
||||
readonly bottom: number;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalEditorPaddingOptions = Readonly<Required<IEditorPaddingOptions>>;
|
||||
|
||||
class EditorPadding extends BaseEditorOption<EditorOption.padding, InternalEditorPaddingOptions> {
|
||||
|
||||
|
@ -2728,6 +2749,9 @@ export interface IEditorParameterHintOptions {
|
|||
cycle?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalParameterHintOptions = Readonly<Required<IEditorParameterHintOptions>>;
|
||||
|
||||
class EditorParameterHints extends BaseEditorOption<EditorOption.parameterHints, InternalParameterHintOptions> {
|
||||
|
@ -2794,6 +2818,9 @@ export interface IQuickSuggestionsOptions {
|
|||
strings?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidQuickSuggestionsOptions = boolean | Readonly<Required<IQuickSuggestionsOptions>>;
|
||||
|
||||
class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggestions, ValidQuickSuggestionsOptions> {
|
||||
|
@ -3226,6 +3253,9 @@ export interface IInlineSuggestOptions {
|
|||
mode?: 'prefix' | 'subword' | 'subwordSmart';
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalInlineSuggestOptions = Readonly<Required<IInlineSuggestOptions>>;
|
||||
|
||||
/**
|
||||
|
@ -3273,6 +3303,9 @@ export interface IBracketPairColorizationOptions {
|
|||
enabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalBracketPairColorizationOptions = Readonly<Required<IBracketPairColorizationOptions>>;
|
||||
|
||||
/**
|
||||
|
@ -3330,6 +3363,9 @@ export interface IGuidesOptions {
|
|||
highlightActiveIndentation?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalGuidesOptions = Readonly<Required<IGuidesOptions>>;
|
||||
|
||||
/**
|
||||
|
@ -3540,6 +3576,9 @@ export interface ISuggestOptions {
|
|||
showSnippets?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
|
||||
|
||||
class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSuggestOptions> {
|
||||
|
@ -3851,6 +3890,9 @@ export interface ISmartSelectOptions {
|
|||
selectLeadingAndTrailingWhitespace?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type SmartSelectOptions = Readonly<Required<ISmartSelectOptions>>;
|
||||
|
||||
class SmartSelect extends BaseEditorOption<EditorOption.smartSelect, SmartSelectOptions> {
|
||||
|
@ -4140,21 +4182,6 @@ export const enum EditorOption {
|
|||
wrappingInfo,
|
||||
}
|
||||
|
||||
/**
|
||||
* WORKAROUND: TS emits "any" for complex editor options values (anything except string, bool, enum, etc. ends up being "any")
|
||||
* @monacodtsreplace
|
||||
* /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/
|
||||
* /comments, any/comments, EditorCommentsOptions/
|
||||
* /find, any/find, EditorFindOptions/
|
||||
* /fontInfo, any/fontInfo, FontInfo/
|
||||
* /gotoLocation, any/gotoLocation, GoToLocationOptions/
|
||||
* /hover, any/hover, EditorHoverOptions/
|
||||
* /lightbulb, any/lightbulb, EditorLightbulbOptions/
|
||||
* /minimap, any/minimap, EditorMinimapOptions/
|
||||
* /parameterHints, any/parameterHints, InternalParameterHintOptions/
|
||||
* /quickSuggestions, any/quickSuggestions, ValidQuickSuggestionsOptions/
|
||||
* /suggest, any/suggest, InternalSuggestOptions/
|
||||
*/
|
||||
export const EditorOptions = {
|
||||
acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(
|
||||
EditorOption.acceptSuggestionOnCommitCharacter, 'acceptSuggestionOnCommitCharacter', true,
|
||||
|
|
38
src/vs/monaco.d.ts
vendored
38
src/vs/monaco.d.ts
vendored
|
@ -3377,8 +3377,6 @@ declare namespace monaco.editor {
|
|||
ignoreEmptyLines?: boolean;
|
||||
}
|
||||
|
||||
export type EditorCommentsOptions = Readonly<Required<IEditorCommentsOptions>>;
|
||||
|
||||
/**
|
||||
* The kind of animation in which the editor's cursor should be rendered.
|
||||
*/
|
||||
|
@ -3462,8 +3460,6 @@ declare namespace monaco.editor {
|
|||
loop?: boolean;
|
||||
}
|
||||
|
||||
export type EditorFindOptions = Readonly<Required<IEditorFindOptions>>;
|
||||
|
||||
export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto';
|
||||
|
||||
/**
|
||||
|
@ -3483,8 +3479,6 @@ declare namespace monaco.editor {
|
|||
alternativeReferenceCommand?: string;
|
||||
}
|
||||
|
||||
export type GoToLocationOptions = Readonly<Required<IGotoLocationOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor hover
|
||||
*/
|
||||
|
@ -3506,8 +3500,6 @@ declare namespace monaco.editor {
|
|||
sticky?: boolean;
|
||||
}
|
||||
|
||||
export type EditorHoverOptions = Readonly<Required<IEditorHoverOptions>>;
|
||||
|
||||
/**
|
||||
* A description for the overview ruler position.
|
||||
*/
|
||||
|
@ -3633,8 +3625,6 @@ declare namespace monaco.editor {
|
|||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type EditorLightbulbOptions = Readonly<Required<IEditorLightbulbOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor inlayHints
|
||||
*/
|
||||
|
@ -3656,8 +3646,6 @@ declare namespace monaco.editor {
|
|||
fontFamily?: string;
|
||||
}
|
||||
|
||||
export type EditorInlayHintsOptions = Readonly<Required<IEditorInlayHintsOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor minimap
|
||||
*/
|
||||
|
@ -3698,8 +3686,6 @@ declare namespace monaco.editor {
|
|||
scale?: number;
|
||||
}
|
||||
|
||||
export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor padding
|
||||
*/
|
||||
|
@ -3714,11 +3700,6 @@ declare namespace monaco.editor {
|
|||
bottom?: number;
|
||||
}
|
||||
|
||||
export interface InternalEditorPaddingOptions {
|
||||
readonly top: number;
|
||||
readonly bottom: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for parameter hints
|
||||
*/
|
||||
|
@ -3735,8 +3716,6 @@ declare namespace monaco.editor {
|
|||
cycle?: boolean;
|
||||
}
|
||||
|
||||
export type InternalParameterHintOptions = Readonly<Required<IEditorParameterHintOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for quick suggestions
|
||||
*/
|
||||
|
@ -3746,8 +3725,6 @@ declare namespace monaco.editor {
|
|||
strings?: boolean;
|
||||
}
|
||||
|
||||
export type ValidQuickSuggestionsOptions = boolean | Readonly<Required<IQuickSuggestionsOptions>>;
|
||||
|
||||
export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
|
||||
|
||||
export enum RenderLineNumbersType {
|
||||
|
@ -3877,8 +3854,6 @@ declare namespace monaco.editor {
|
|||
mode?: 'prefix' | 'subword' | 'subwordSmart';
|
||||
}
|
||||
|
||||
export type InternalInlineSuggestOptions = Readonly<Required<IInlineSuggestOptions>>;
|
||||
|
||||
export interface IBracketPairColorizationOptions {
|
||||
/**
|
||||
* Enable or disable bracket pair colorization.
|
||||
|
@ -3886,8 +3861,6 @@ declare namespace monaco.editor {
|
|||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type InternalBracketPairColorizationOptions = Readonly<Required<IBracketPairColorizationOptions>>;
|
||||
|
||||
export interface IGuidesOptions {
|
||||
/**
|
||||
* Enable rendering of bracket pair guides.
|
||||
|
@ -3905,8 +3878,6 @@ declare namespace monaco.editor {
|
|||
highlightActiveIndentation?: boolean;
|
||||
}
|
||||
|
||||
export type InternalGuidesOptions = Readonly<Required<IGuidesOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor suggest widget
|
||||
*/
|
||||
|
@ -4065,14 +4036,10 @@ declare namespace monaco.editor {
|
|||
showSnippets?: boolean;
|
||||
}
|
||||
|
||||
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
|
||||
|
||||
export interface ISmartSelectOptions {
|
||||
selectLeadingAndTrailingWhitespace?: boolean;
|
||||
}
|
||||
|
||||
export type SmartSelectOptions = Readonly<Required<ISmartSelectOptions>>;
|
||||
|
||||
/**
|
||||
* Describes how to indent wrapped lines.
|
||||
*/
|
||||
|
@ -4235,6 +4202,7 @@ declare namespace monaco.editor {
|
|||
layoutInfo = 129,
|
||||
wrappingInfo = 130
|
||||
}
|
||||
|
||||
export const EditorOptions: {
|
||||
acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
|
||||
acceptSuggestionOnEnter: IEditorOption<EditorOption.acceptSuggestionOnEnter, 'on' | 'off' | 'smart'>;
|
||||
|
@ -4310,11 +4278,11 @@ declare namespace monaco.editor {
|
|||
occurrencesHighlight: IEditorOption<EditorOption.occurrencesHighlight, boolean>;
|
||||
overviewRulerBorder: IEditorOption<EditorOption.overviewRulerBorder, boolean>;
|
||||
overviewRulerLanes: IEditorOption<EditorOption.overviewRulerLanes, number>;
|
||||
padding: IEditorOption<EditorOption.padding, InternalEditorPaddingOptions>;
|
||||
padding: IEditorOption<EditorOption.padding, Readonly<Required<IEditorPaddingOptions>>>;
|
||||
parameterHints: IEditorOption<EditorOption.parameterHints, Readonly<Required<IEditorParameterHintOptions>>>;
|
||||
peekWidgetDefaultFocus: IEditorOption<EditorOption.peekWidgetDefaultFocus, 'tree' | 'editor'>;
|
||||
definitionLinkOpensInPeek: IEditorOption<EditorOption.definitionLinkOpensInPeek, boolean>;
|
||||
quickSuggestions: IEditorOption<EditorOption.quickSuggestions, ValidQuickSuggestionsOptions>;
|
||||
quickSuggestions: IEditorOption<EditorOption.quickSuggestions, any>;
|
||||
quickSuggestionsDelay: IEditorOption<EditorOption.quickSuggestionsDelay, number>;
|
||||
readOnly: IEditorOption<EditorOption.readOnly, boolean>;
|
||||
renameOnType: IEditorOption<EditorOption.renameOnType, boolean>;
|
||||
|
|
Loading…
Reference in a new issue