diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe index 4fb5afe78043a..f16ed378bd579 100644 --- a/build/monaco/monaco.d.ts.recipe +++ b/build/monaco/monaco.d.ts.recipe @@ -48,7 +48,7 @@ declare namespace monaco.editor { #include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors #include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule #include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions -#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor +#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IGlobalEditorOptions, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor export interface ICommandHandler { (...args: any[]): void; } diff --git a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts index 86ce9f07ace4f..4c6212d9a1980 100644 --- a/src/vs/editor/standalone/browser/standaloneCodeEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneCodeEditor.ts @@ -77,10 +77,58 @@ export interface IActionDescriptor { run(editor: ICodeEditor): void | Promise; } +/** + * Options which apply for all editors. + */ +export interface IGlobalEditorOptions { + /** + * The number of spaces a tab is equal to. + * This setting is overridden based on the file contents when `detectIndentation` is on. + * Defaults to 4. + */ + tabSize?: number; + /** + * Insert spaces when pressing `Tab`. + * This setting is overridden based on the file contents when detectIndentation` is on. + * Defaults to true. + */ + insertSpaces?: boolean; + /** + * Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents. + * Defaults to true. + */ + detectIndentation?: boolean; + /** + * Remove trailing auto inserted whitespace. + * Defaults to true. + */ + trimAutoWhitespace?: boolean; + /** + * Special handling for large files to disable certain memory intensive features. + * Defaults to true. + */ + largeFileOptimizations?: boolean; + /** + * Controls whether completions should be computed based on words in the document. + * Defaults to true. + */ + wordBasedSuggestions?: boolean; + /** + * Keep peek editors open even when double clicking their content or when hitting `Escape`. + * Defaults to false. + */ + stablePeek?: boolean; + /** + * Lines above this length will not be tokenized for performance reasons. + * Defaults to 20000. + */ + maxTokenizationLineLength?: number; +} + /** * The options to create an editor. */ -export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions { +export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions { /** * The initial model associated with this code editor. */ @@ -125,6 +173,7 @@ export interface IDiffEditorConstructionOptions extends IDiffEditorOptions { } export interface IStandaloneCodeEditor extends ICodeEditor { + updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void; addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable; @@ -337,7 +386,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon super.dispose(); } - public updateOptions(newOptions: IEditorOptions): void { + public updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void { applyConfigurationValues(this._configurationService, newOptions, false); super.updateOptions(newOptions); } diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index ba1514ee9991e..32a3f131d6bfe 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1048,10 +1048,58 @@ declare namespace monaco.editor { run(editor: ICodeEditor): void | Promise; } + /** + * Options which apply for all editors. + */ + export interface IGlobalEditorOptions { + /** + * The number of spaces a tab is equal to. + * This setting is overridden based on the file contents when `detectIndentation` is on. + * Defaults to 4. + */ + tabSize?: number; + /** + * Insert spaces when pressing `Tab`. + * This setting is overridden based on the file contents when detectIndentation` is on. + * Defaults to true. + */ + insertSpaces?: boolean; + /** + * Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents. + * Defaults to true. + */ + detectIndentation?: boolean; + /** + * Remove trailing auto inserted whitespace. + * Defaults to true. + */ + trimAutoWhitespace?: boolean; + /** + * Special handling for large files to disable certain memory intensive features. + * Defaults to true. + */ + largeFileOptimizations?: boolean; + /** + * Controls whether completions should be computed based on words in the document. + * Defaults to true. + */ + wordBasedSuggestions?: boolean; + /** + * Keep peek editors open even when double clicking their content or when hitting `Escape`. + * Defaults to false. + */ + stablePeek?: boolean; + /** + * Lines above this length will not be tokenized for performance reasons. + * Defaults to 20000. + */ + maxTokenizationLineLength?: number; + } + /** * The options to create an editor. */ - export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions { + export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions { /** * The initial model associated with this code editor. */ @@ -1096,6 +1144,7 @@ declare namespace monaco.editor { } export interface IStandaloneCodeEditor extends ICodeEditor { + updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void; addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; createContextKey(key: string, defaultValue: T): IContextKey; addAction(descriptor: IActionDescriptor): IDisposable;