提交 5621fcab 编写于 作者: A Alex Dima

Reduce standalone editor API surface

上级 b5461b22
......@@ -36,7 +36,6 @@ declare module monaco {
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
#include(vs/base/common/uri): URI
#include(vs/base/common/eventEmitter): EmitterEvent, BulkListenerCallback
#include(vs/base/common/keyCodes): KeyCode, KeyMod
#include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement
#include(vs/base/common/actions): IAction
......
......@@ -192,6 +192,9 @@ export function setMarkers(model:IModel, owner:string, markers: IMarkerData[]):
markerService.changeOne(owner, model.uri, markers);
}
/**
* @internal
*/
export function getOrCreateMode(modeId: string):TPromise<modes.IMode> {
startup.initStaticServicesIfNecessary();
var modeService = ensureStaticPlatformServices(null).modeService;
......@@ -209,6 +212,9 @@ export function configureMode(modeId: string, options: any): void {
modeService.configureModeById(modeId, options);
}
/**
* @internal
*/
export function createCustomMode(language:ILanguage): TPromise<modes.IMode> {
startup.initStaticServicesIfNecessary();
let staticPlatformServices = ensureStaticPlatformServices(null);
......@@ -342,8 +348,8 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
setMarkers: setMarkers,
getOrCreateMode: getOrCreateMode,
createCustomMode: createCustomMode,
// getOrCreateMode: getOrCreateMode,
// createCustomMode: createCustomMode,
createWebWorker: createWebWorker,
colorizeElement: colorizeElement,
colorize: colorize,
......@@ -365,15 +371,15 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
// classes
MonacoWebWorker: <any>MonacoWebWorker,
InternalEditorScrollbarOptions: editorCommon.InternalEditorScrollbarOptions,
EditorWrappingInfo: editorCommon.EditorWrappingInfo,
InternalEditorViewOptions: editorCommon.InternalEditorViewOptions,
EditorContribOptions: editorCommon.EditorContribOptions,
InternalEditorOptions: editorCommon.InternalEditorOptions,
OverviewRulerPosition: editorCommon.OverviewRulerPosition,
EditorLayoutInfo: editorCommon.EditorLayoutInfo,
BareFontInfo: editorCommon.BareFontInfo,
FontInfo: editorCommon.FontInfo,
InternalEditorScrollbarOptions: <any>editorCommon.InternalEditorScrollbarOptions,
EditorWrappingInfo: <any>editorCommon.EditorWrappingInfo,
InternalEditorViewOptions: <any>editorCommon.InternalEditorViewOptions,
EditorContribOptions: <any>editorCommon.EditorContribOptions,
InternalEditorOptions: <any>editorCommon.InternalEditorOptions,
OverviewRulerPosition: <any>editorCommon.OverviewRulerPosition,
EditorLayoutInfo: <any>editorCommon.EditorLayoutInfo,
BareFontInfo: <any>editorCommon.BareFontInfo,
FontInfo: <any>editorCommon.FontInfo,
// vars
EditorType: editorCommon.EditorType,
......
......@@ -265,6 +265,9 @@ export function registerLinkProvider(languageId:string, support:modes.LinkProvid
return modes.LinkProviderRegistry.register(languageId, support);
}
/**
* @internal
*/
export function registerMonarchStandaloneLanguage(language:ILanguageExtensionPoint, defModule:string): void {
ModesRegistry.registerLanguage(language);
......@@ -360,7 +363,7 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages {
registerLinkProvider: registerLinkProvider,
// other methods
registerMonarchStandaloneLanguage: registerMonarchStandaloneLanguage,
// registerMonarchStandaloneLanguage: registerMonarchStandaloneLanguage,
register: register,
onLanguage: onLanguage,
......@@ -368,9 +371,6 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages {
DocumentHighlightKind: modes.DocumentHighlightKind,
CompletionItemKind: CompletionItemKind,
SymbolKind: modes.SymbolKind,
IndentAction: modes.IndentAction,
// classes
Location: modes.Location
IndentAction: modes.IndentAction
};
}
......@@ -462,6 +462,9 @@ export class InternalEditorScrollbarOptions {
verticalSliderSize: number;
mouseWheelScrollSensitivity: number;
/**
* @internal
*/
constructor(source:{
arrowSize:number;
vertical:ScrollbarVisibility;
......@@ -490,6 +493,9 @@ export class InternalEditorScrollbarOptions {
this.mouseWheelScrollSensitivity = Number(source.mouseWheelScrollSensitivity);
}
/**
* @internal
*/
public equals(other:InternalEditorScrollbarOptions): boolean {
return (
this.arrowSize === other.arrowSize
......@@ -507,6 +513,9 @@ export class InternalEditorScrollbarOptions {
);
}
/**
* @internal
*/
public clone(): InternalEditorScrollbarOptions {
return new InternalEditorScrollbarOptions(this);
}
......@@ -522,6 +531,9 @@ export class EditorWrappingInfo {
wordWrapBreakAfterCharacters: string;
wordWrapBreakObtrusiveCharacters: string;
/**
* @internal
*/
constructor(source:{
isViewportWrapping: boolean;
wrappingColumn: number;
......@@ -538,6 +550,9 @@ export class EditorWrappingInfo {
this.wordWrapBreakObtrusiveCharacters = String(source.wordWrapBreakObtrusiveCharacters);
}
/**
* @internal
*/
public equals(other:EditorWrappingInfo): boolean {
return (
this.isViewportWrapping === other.isViewportWrapping
......@@ -549,6 +564,9 @@ export class EditorWrappingInfo {
);
}
/**
* @internal
*/
public clone(): EditorWrappingInfo {
return new EditorWrappingInfo(this);
}
......@@ -578,6 +596,9 @@ export class InternalEditorViewOptions {
indentGuides: boolean;
scrollbar:InternalEditorScrollbarOptions;
/**
* @internal
*/
constructor(source:{
theme:string;
canUseTranslate3d:boolean;
......@@ -650,6 +671,9 @@ export class InternalEditorViewOptions {
return true;
}
/**
* @internal
*/
public equals(other:InternalEditorViewOptions): boolean {
return (
this.theme === other.theme
......@@ -675,6 +699,9 @@ export class InternalEditorViewOptions {
);
}
/**
* @internal
*/
public createChangeEvent(newOpts:InternalEditorViewOptions): IViewConfigurationChangedEvent {
return {
theme: this.theme !== newOpts.theme,
......@@ -700,6 +727,9 @@ export class InternalEditorViewOptions {
};
}
/**
* @internal
*/
public clone(): InternalEditorViewOptions {
return new InternalEditorViewOptions(this);
}
......@@ -743,6 +773,9 @@ export class EditorContribOptions {
referenceInfos: boolean;
folding: boolean;
/**
* @internal
*/
constructor(source:{
selectionClipboard: boolean;
hover:boolean;
......@@ -773,6 +806,9 @@ export class EditorContribOptions {
this.folding = Boolean(source.folding);
}
/**
* @internal
*/
public equals(other: EditorContribOptions): boolean {
return (
this.selectionClipboard === other.selectionClipboard
......@@ -791,6 +827,9 @@ export class EditorContribOptions {
);
}
/**
* @internal
*/
public clone(): EditorContribOptions {
return new EditorContribOptions(this);
}
......@@ -817,6 +856,9 @@ export class InternalEditorOptions {
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
/**
* @internal
*/
constructor(source: {
lineHeight:number;
readOnly:boolean;
......@@ -843,6 +885,9 @@ export class InternalEditorOptions {
this.contribInfo = source.contribInfo.clone();
}
/**
* @internal
*/
public equals(other:InternalEditorOptions): boolean {
return (
this.lineHeight === other.lineHeight
......@@ -859,6 +904,9 @@ export class InternalEditorOptions {
);
}
/**
* @internal
*/
public createChangeEvent(newOpts:InternalEditorOptions): IConfigurationChangedEvent {
return {
lineHeight: (this.lineHeight !== newOpts.lineHeight),
......@@ -875,6 +923,9 @@ export class InternalEditorOptions {
};
}
/**
* @internal
*/
public clone(): InternalEditorOptions {
return new InternalEditorOptions(this);
}
......@@ -2385,6 +2436,9 @@ export class OverviewRulerPosition {
*/
right:number;
/**
* @internal
*/
constructor(source:{
width:number;
height:number;
......@@ -2397,6 +2451,9 @@ export class OverviewRulerPosition {
this.right = source.right|0;
}
/**
* @internal
*/
public equals(other:OverviewRulerPosition): boolean {
return (
this.width === other.width
......@@ -2406,6 +2463,9 @@ export class OverviewRulerPosition {
);
}
/**
* @internal
*/
public clone(): OverviewRulerPosition {
return new OverviewRulerPosition(this);
}
......@@ -2492,6 +2552,9 @@ export class EditorLayoutInfo {
*/
overviewRuler:OverviewRulerPosition;
/**
* @internal
*/
constructor(source:{
width:number;
height:number;
......@@ -2530,6 +2593,9 @@ export class EditorLayoutInfo {
this.overviewRuler = source.overviewRuler.clone();
}
/**
* @internal
*/
public equals(other:EditorLayoutInfo): boolean {
return (
this.width === other.width
......@@ -2552,6 +2618,9 @@ export class EditorLayoutInfo {
);
}
/**
* @internal
*/
public clone(): EditorLayoutInfo {
return new EditorLayoutInfo(this);
}
......@@ -2766,6 +2835,9 @@ export class BareFontInfo {
fontSize: number;
lineHeight: number;
/**
* @internal
*/
constructor(opts: {
fontFamily: string;
fontSize: number;
......@@ -2776,6 +2848,9 @@ export class BareFontInfo {
this.lineHeight = opts.lineHeight|0;
}
/**
* @internal
*/
public getId(): string {
return this.fontFamily + '-' + this.fontSize + '-' + this.lineHeight;
}
......@@ -2789,6 +2864,9 @@ export class FontInfo extends BareFontInfo {
spaceWidth:number;
maxDigitWidth: number;
/**
* @internal
*/
constructor(opts:{
fontFamily: string;
fontSize: number;
......@@ -2805,6 +2883,9 @@ export class FontInfo extends BareFontInfo {
this.maxDigitWidth = opts.maxDigitWidth;
}
/**
* @internal
*/
public equals(other:FontInfo): boolean {
return (
this.fontFamily === other.fontFamily
......@@ -2817,6 +2898,9 @@ export class FontInfo extends BareFontInfo {
);
}
/**
* @internal
*/
public clone(): FontInfo {
return new FontInfo(this);
}
......
......@@ -456,7 +456,7 @@ export interface ReferenceProvider {
}
export class Location {
export interface Location {
uri: URI;
range: editorCommon.IRange;
}
......
......@@ -5,7 +5,6 @@
'use strict';
import {Emitter} from 'vs/base/common/event';
import {EmitterEvent} from 'vs/base/common/eventEmitter';
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
import {Position} from 'vs/editor/common/core/position';
import {Range} from 'vs/editor/common/core/range';
......@@ -23,7 +22,6 @@ export function createMonacoBaseAPI(): typeof monaco {
languages: undefined,
CancellationTokenSource: CancellationTokenSource,
Emitter: Emitter,
EmitterEvent: EmitterEvent,
KeyCode: KeyCode,
KeyMod: KeyMod,
Position: Position,
......
......@@ -152,16 +152,6 @@ declare module monaco {
static revive(data: any): Uri;
}
export class EmitterEvent {
constructor(eventType?: string, data?: any);
getType(): string;
getData(): any;
}
export interface BulkListenerCallback {
(value: EmitterEvent[]): void;
}
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
......@@ -669,10 +659,6 @@ declare module monaco.editor {
export function setMarkers(model: IModel, owner: string, markers: IMarkerData[]): void;
export function getOrCreateMode(modeId: string): Promise<languages.IMode>;
export function createCustomMode(language: ILanguage): Promise<languages.IMode>;
export class MonacoWebWorker<T> {
dispose(): void;
getProxy(): Promise<T>;
......@@ -1165,22 +1151,6 @@ declare module monaco.editor {
verticalScrollbarSize: number;
verticalSliderSize: number;
mouseWheelScrollSensitivity: number;
constructor(source: {
arrowSize: number;
vertical: ScrollbarVisibility;
horizontal: ScrollbarVisibility;
useShadows: boolean;
verticalHasArrows: boolean;
horizontalHasArrows: boolean;
handleMouseWheel: boolean;
horizontalScrollbarSize: number;
horizontalSliderSize: number;
verticalScrollbarSize: number;
verticalSliderSize: number;
mouseWheelScrollSensitivity: number;
});
equals(other: InternalEditorScrollbarOptions): boolean;
clone(): InternalEditorScrollbarOptions;
}
export class EditorWrappingInfo {
......@@ -1191,16 +1161,6 @@ declare module monaco.editor {
wordWrapBreakBeforeCharacters: string;
wordWrapBreakAfterCharacters: string;
wordWrapBreakObtrusiveCharacters: string;
constructor(source: {
isViewportWrapping: boolean;
wrappingColumn: number;
wrappingIndent: WrappingIndent;
wordWrapBreakBeforeCharacters: string;
wordWrapBreakAfterCharacters: string;
wordWrapBreakObtrusiveCharacters: string;
});
equals(other: EditorWrappingInfo): boolean;
clone(): EditorWrappingInfo;
}
export class InternalEditorViewOptions {
......@@ -1225,31 +1185,6 @@ declare module monaco.editor {
renderWhitespace: boolean;
indentGuides: boolean;
scrollbar: InternalEditorScrollbarOptions;
constructor(source: {
theme: string;
canUseTranslate3d: boolean;
experimentalScreenReader: boolean;
rulers: number[];
ariaLabel: string;
lineNumbers: any;
selectOnLineNumbers: boolean;
glyphMargin: boolean;
revealHorizontalRightPadding: number;
roundedSelection: boolean;
overviewRulerLanes: number;
cursorBlinking: string;
cursorStyle: TextEditorCursorStyle;
hideCursorInOverviewRuler: boolean;
scrollBeyondLastLine: boolean;
editorClassName: string;
stopRenderingLineAfter: number;
renderWhitespace: boolean;
indentGuides: boolean;
scrollbar: InternalEditorScrollbarOptions;
});
equals(other: InternalEditorViewOptions): boolean;
createChangeEvent(newOpts: InternalEditorViewOptions): IViewConfigurationChangedEvent;
clone(): InternalEditorViewOptions;
}
export interface IViewConfigurationChangedEvent {
......@@ -1289,23 +1224,6 @@ declare module monaco.editor {
outlineMarkers: boolean;
referenceInfos: boolean;
folding: boolean;
constructor(source: {
selectionClipboard: boolean;
hover: boolean;
contextmenu: boolean;
quickSuggestions: boolean;
quickSuggestionsDelay: number;
iconsInSuggestions: boolean;
formatOnType: boolean;
suggestOnTriggerCharacters: boolean;
acceptSuggestionOnEnter: boolean;
selectionHighlight: boolean;
outlineMarkers: boolean;
referenceInfos: boolean;
folding: boolean;
});
equals(other: EditorContribOptions): boolean;
clone(): EditorContribOptions;
}
/**
......@@ -1324,22 +1242,6 @@ declare module monaco.editor {
viewInfo: InternalEditorViewOptions;
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
constructor(source: {
lineHeight: number;
readOnly: boolean;
wordSeparators: string;
autoClosingBrackets: boolean;
useTabStops: boolean;
tabFocusMode: boolean;
layoutInfo: EditorLayoutInfo;
fontInfo: FontInfo;
viewInfo: InternalEditorViewOptions;
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
});
equals(other: InternalEditorOptions): boolean;
createChangeEvent(newOpts: InternalEditorOptions): IConfigurationChangedEvent;
clone(): InternalEditorOptions;
}
/**
......@@ -2325,14 +2227,6 @@ declare module monaco.editor {
* Right position for the overview ruler
*/
right: number;
constructor(source: {
width: number;
height: number;
top: number;
right: number;
});
equals(other: OverviewRulerPosition): boolean;
clone(): OverviewRulerPosition;
}
/**
......@@ -2408,27 +2302,6 @@ declare module monaco.editor {
* The position of the overview ruler.
*/
overviewRuler: OverviewRulerPosition;
constructor(source: {
width: number;
height: number;
glyphMarginLeft: number;
glyphMarginWidth: number;
glyphMarginHeight: number;
lineNumbersLeft: number;
lineNumbersWidth: number;
lineNumbersHeight: number;
decorationsLeft: number;
decorationsWidth: number;
decorationsHeight: number;
contentLeft: number;
contentWidth: number;
contentHeight: number;
verticalScrollbarWidth: number;
horizontalScrollbarHeight: number;
overviewRuler: OverviewRulerPosition;
});
equals(other: EditorLayoutInfo): boolean;
clone(): EditorLayoutInfo;
}
/**
......@@ -2638,12 +2511,6 @@ declare module monaco.editor {
fontFamily: string;
fontSize: number;
lineHeight: number;
constructor(opts: {
fontFamily: string;
fontSize: number;
lineHeight: number;
});
getId(): string;
}
export class FontInfo extends BareFontInfo {
......@@ -2652,17 +2519,6 @@ declare module monaco.editor {
typicalFullwidthCharacterWidth: number;
spaceWidth: number;
maxDigitWidth: number;
constructor(opts: {
fontFamily: string;
fontSize: number;
lineHeight: number;
typicalHalfwidthCharacterWidth: number;
typicalFullwidthCharacterWidth: number;
spaceWidth: number;
maxDigitWidth: number;
});
equals(other: FontInfo): boolean;
clone(): FontInfo;
}
export interface INewScrollPosition {
......@@ -3499,8 +3355,6 @@ declare module monaco.languages {
export function registerLinkProvider(languageId: string, support: LinkProvider): IDisposable;
export function registerMonarchStandaloneLanguage(language: ILanguageExtensionPoint, defModule: string): void;
export function register(language: ILanguageExtensionPoint): void;
export function onLanguage(languageId: string, callback: () => void): IDisposable;
......@@ -3653,7 +3507,7 @@ declare module monaco.languages {
provideReferences(model: editor.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable<Location[]>;
}
export class Location {
export interface Location {
uri: Uri;
range: IRange;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册