mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode cbeff45f80213db0ddda2183170281ed97ed3b12 (#8670)
* Merge from vscode cbeff45f80213db0ddda2183170281ed97ed3b12 * fix null strict checks
This commit is contained in:
@@ -122,7 +122,7 @@ export class MouseHandler extends ViewEventHandler {
|
||||
e.stopPropagation();
|
||||
}
|
||||
};
|
||||
this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, true));
|
||||
this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { capture: true, passive: false }));
|
||||
|
||||
this._context.addEventHandler(this);
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="30" height="50" viewBox="0 0 30 50" style="enable-background:new 0 0 30 50;"><polygon style="fill:#FFFFFF;stroke:#000000;stroke-width:2;" points="29,2.4 3.8,27.6 14,27.6 6.4,43 12.6,45 20.2,29.8 29,36"/></svg>
|
||||
|
Before Width: | Height: | Size: 273 B |
@@ -1,2 +0,0 @@
|
||||
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 26 38" style="enable-background:new 0 0 26 38;" width="26" height="38"><style type="text/css">.st0{stroke:#FFFFFF;stroke-miterlimit:10;}</style> <title>flipped-cursor-mac</title><path class="st0" d="M10.6,33.2l3.2-9.4H4.2L25,2.4v28.8L19.4,26l-3.2,9.2c-0.4,1-1.6,1.6-2.6,1.2L12,35.8 C10.8,35.4,10.2,34.4,10.6,33.2z"/></svg>
|
||||
|
Before Width: | Height: | Size: 447 B |
@@ -1 +0,0 @@
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 13 19" style="enable-background:new 0 0 13 19;" width="13" height="19"><style type="text/css">.st0{stroke:#FFFFFF;stroke-miterlimit:10;}</style><title>flipped-cursor-mac</title><path class="st0" d="M5.3,16.6l1.6-4.7H2.1L12.5,1.2v14.4L9.7,13l-1.6,4.6c-0.2,0.5-0.8,0.8-1.3,0.6L6,17.9 C5.4,17.7,5.1,17.2,5.3,16.6z"/></svg>
|
||||
|
Before Width: | Height: | Size: 443 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="25" x="0px" y="0px" viewBox="0 0 15 25" style="enable-background:new 0 0 15 25;"><polygon style="fill:#FFFFFF;stroke:#000000" points="14.5,1.2 1.9,13.8 7,13.8 3.2,21.5 6.3,22.5 10.1,14.9 14.5,18"/></svg>
|
||||
|
Before Width: | Height: | Size: 262 B |
@@ -19,20 +19,6 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.monaco-editor .margin-view-overlays .line-numbers {
|
||||
cursor: -webkit-image-set(
|
||||
url('flipped-cursor.svg') 1x,
|
||||
url('flipped-cursor-2x.svg') 2x
|
||||
) 30 0, default;
|
||||
}
|
||||
|
||||
.monaco-editor.mac .margin-view-overlays .line-numbers {
|
||||
cursor: -webkit-image-set(
|
||||
url('flipped-cursor-mac.svg') 1x,
|
||||
url('flipped-cursor-mac-2x.svg') 2x
|
||||
) 24 3, default;
|
||||
}
|
||||
|
||||
.monaco-editor .margin-view-overlays .line-numbers.lh-odd {
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
/* -- smooth-caret-animation -- */
|
||||
.monaco-editor .cursors-layer.cursor-smooth-caret-animation > .cursor {
|
||||
transition: 80ms;
|
||||
transition: all 80ms;
|
||||
}
|
||||
|
||||
/* -- block-outline-style -- */
|
||||
@@ -85,4 +85,4 @@
|
||||
|
||||
.cursor-expand > .cursor {
|
||||
animation: monaco-cursor-expand 0.5s ease-in-out 0s 20 alternate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,6 +996,7 @@ class EditorAccessibilitySupport extends BaseEditorOption<EditorOption.accessibi
|
||||
|
||||
/**
|
||||
* The kind of animation in which the editor's cursor should be rendered.
|
||||
* @internal
|
||||
*/
|
||||
export const enum TextEditorCursorBlinkingStyle {
|
||||
/**
|
||||
@@ -1040,6 +1041,7 @@ function _cursorBlinkingStyleFromString(cursorBlinkingStyle: 'blink' | 'smooth'
|
||||
|
||||
/**
|
||||
* The style in which the editor's cursor should be rendered.
|
||||
* @internal
|
||||
*/
|
||||
export enum TextEditorCursorStyle {
|
||||
/**
|
||||
@@ -1165,6 +1167,9 @@ export interface IEditorFindOptions {
|
||||
globalFindClipboard?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorFindOptions = Readonly<Required<IEditorFindOptions>>;
|
||||
|
||||
class EditorFind extends BaseEditorOption<EditorOption.find, EditorFindOptions> {
|
||||
@@ -1352,6 +1357,9 @@ export interface IGotoLocationOptions {
|
||||
alternativeReferenceCommand?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type GoToLocationOptions = Readonly<Required<IGotoLocationOptions>>;
|
||||
|
||||
class EditorGoToLocation extends BaseEditorOption<EditorOption.gotoLocation, GoToLocationOptions> {
|
||||
@@ -1481,6 +1489,9 @@ export interface IEditorHoverOptions {
|
||||
sticky?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorHoverOptions = Readonly<Required<IEditorHoverOptions>>;
|
||||
|
||||
class EditorHover extends BaseEditorOption<EditorOption.hover, EditorHoverOptions> {
|
||||
@@ -1857,6 +1868,9 @@ export interface IEditorLightbulbOptions {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorLightbulbOptions = Readonly<Required<IEditorLightbulbOptions>>;
|
||||
|
||||
class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, EditorLightbulbOptions> {
|
||||
@@ -1948,6 +1962,9 @@ export interface IEditorMinimapOptions {
|
||||
scale?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;
|
||||
|
||||
class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimapOptions> {
|
||||
@@ -2049,6 +2066,9 @@ export interface IEditorParameterHintOptions {
|
||||
cycle?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalParameterHintOptions = Readonly<Required<IEditorParameterHintOptions>>;
|
||||
|
||||
class EditorParameterHints extends BaseEditorOption<EditorOption.parameterHints, InternalParameterHintOptions> {
|
||||
@@ -2115,6 +2135,9 @@ export interface IQuickSuggestionsOptions {
|
||||
strings: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type ValidQuickSuggestionsOptions = boolean | Readonly<Required<IQuickSuggestionsOptions>>;
|
||||
|
||||
class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggestions, ValidQuickSuggestionsOptions> {
|
||||
@@ -2191,6 +2214,9 @@ class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggesti
|
||||
|
||||
export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const enum RenderLineNumbersType {
|
||||
Off = 0,
|
||||
On = 1,
|
||||
@@ -2199,6 +2225,9 @@ export const enum RenderLineNumbersType {
|
||||
Custom = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface InternalEditorRenderLineNumbersOptions {
|
||||
readonly renderType: RenderLineNumbersType;
|
||||
readonly renderFn: ((lineNumber: number) => string) | null;
|
||||
@@ -2354,6 +2383,9 @@ export interface IEditorScrollbarOptions {
|
||||
horizontalSliderSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface InternalEditorScrollbarOptions {
|
||||
readonly arrowSize: number;
|
||||
readonly vertical: ScrollbarVisibility;
|
||||
@@ -2568,6 +2600,9 @@ export interface ISuggestOptions {
|
||||
showSnippets?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
|
||||
|
||||
class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSuggestOptions> {
|
||||
@@ -2861,6 +2896,7 @@ class EditorTabFocusMode extends ComputedEditorOption<EditorOption.tabFocusMode,
|
||||
|
||||
/**
|
||||
* Describes how to indent wrapped lines.
|
||||
* @internal
|
||||
*/
|
||||
export const enum WrappingIndent {
|
||||
/**
|
||||
@@ -2894,6 +2930,9 @@ function _wrappingIndentFromString(wrappingIndent: 'none' | 'same' | 'indent' |
|
||||
|
||||
//#region wrappingInfo
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface EditorWrappingInfo {
|
||||
readonly isDominatedByLongLines: boolean;
|
||||
readonly isWordWrapMinified: boolean;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
|
||||
import { EditorSimpleWorker } from 'vs/editor/common/services/editorSimpleWorker';
|
||||
import { IDiffComputationResult, IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { regExpFlags } from 'vs/base/common/strings';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -52,7 +52,7 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
|
||||
private readonly _logService: ILogService;
|
||||
constructor(
|
||||
@IModelService modelService: IModelService,
|
||||
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
|
||||
@IResourceConfigurationService configurationService: IResourceConfigurationService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super();
|
||||
@@ -129,14 +129,14 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
|
||||
class WordBasedCompletionItemProvider implements modes.CompletionItemProvider {
|
||||
|
||||
private readonly _workerManager: WorkerManager;
|
||||
private readonly _configurationService: ITextResourceConfigurationService;
|
||||
private readonly _configurationService: IResourceConfigurationService;
|
||||
private readonly _modelService: IModelService;
|
||||
|
||||
readonly _debugDisplayName = 'wordbasedCompletions';
|
||||
|
||||
constructor(
|
||||
workerManager: WorkerManager,
|
||||
configurationService: ITextResourceConfigurationService,
|
||||
configurationService: IResourceConfigurationService,
|
||||
modelService: IModelService
|
||||
) {
|
||||
this._workerManager = workerManager;
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Range } from 'vs/editor/common/core/range';
|
||||
import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model';
|
||||
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
|
||||
import { IModelLanguageChangedEvent, IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { LanguageIdentifier, SemanticTokensProviderRegistry, SemanticTokensProvider, SemanticTokensLegend, SemanticTokens, SemanticTokensEdits } from 'vs/editor/common/modes';
|
||||
import { LanguageIdentifier, SemanticTokensProviderRegistry, SemanticTokensProvider, SemanticTokensLegend, SemanticTokens, SemanticTokensEdits, TokenMetadata } from 'vs/editor/common/modes';
|
||||
import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegistry';
|
||||
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -24,6 +24,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { SparseEncodedTokens, MultilineTokens2 } from 'vs/editor/common/model/tokensStore';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
|
||||
function MODEL_ID(resource: URI): string {
|
||||
return resource.toString();
|
||||
@@ -120,7 +121,8 @@ export class ModelServiceImpl extends Disposable implements IModelService {
|
||||
constructor(
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService,
|
||||
@IThemeService themeService: IThemeService
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this._configurationService = configurationService;
|
||||
@@ -131,7 +133,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
|
||||
this._configurationServiceSubscription = this._configurationService.onDidChangeConfiguration(e => this._updateModelOptions());
|
||||
this._updateModelOptions();
|
||||
|
||||
this._register(new SemanticColoringFeature(this, themeService));
|
||||
this._register(new SemanticColoringFeature(this, themeService, logService));
|
||||
}
|
||||
|
||||
private static _readModelOptions(config: IRawConfig, isForSimpleWidget: boolean): ITextModelCreationOptions {
|
||||
@@ -443,10 +445,10 @@ class SemanticColoringFeature extends Disposable {
|
||||
private _watchers: Record<string, ModelSemanticColoring>;
|
||||
private _semanticStyling: SemanticStyling;
|
||||
|
||||
constructor(modelService: IModelService, themeService: IThemeService) {
|
||||
constructor(modelService: IModelService, themeService: IThemeService, logService: ILogService) {
|
||||
super();
|
||||
this._watchers = Object.create(null);
|
||||
this._semanticStyling = this._register(new SemanticStyling(themeService));
|
||||
this._semanticStyling = this._register(new SemanticStyling(themeService, logService));
|
||||
this._register(modelService.onModelAdded((model) => {
|
||||
this._watchers[model.uri.toString()] = new ModelSemanticColoring(model, themeService, this._semanticStyling);
|
||||
}));
|
||||
@@ -462,7 +464,8 @@ class SemanticStyling extends Disposable {
|
||||
private _caches: WeakMap<SemanticTokensProvider, SemanticColoringProviderStyling>;
|
||||
|
||||
constructor(
|
||||
private readonly _themeService: IThemeService
|
||||
private readonly _themeService: IThemeService,
|
||||
private readonly _logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this._caches = new WeakMap<SemanticTokensProvider, SemanticColoringProviderStyling>();
|
||||
@@ -476,7 +479,7 @@ class SemanticStyling extends Disposable {
|
||||
|
||||
public get(provider: SemanticTokensProvider): SemanticColoringProviderStyling {
|
||||
if (!this._caches.has(provider)) {
|
||||
this._caches.set(provider, new SemanticColoringProviderStyling(provider.getLegend(), this._themeService));
|
||||
this._caches.set(provider, new SemanticColoringProviderStyling(provider.getLegend(), this._themeService, this._logService));
|
||||
}
|
||||
return this._caches.get(provider)!;
|
||||
}
|
||||
@@ -581,7 +584,8 @@ class SemanticColoringProviderStyling {
|
||||
|
||||
constructor(
|
||||
private readonly _legend: SemanticTokensLegend,
|
||||
private readonly _themeService: IThemeService
|
||||
private readonly _themeService: IThemeService,
|
||||
private readonly _logService: ILogService
|
||||
) {
|
||||
this._hashTable = new HashTable();
|
||||
}
|
||||
@@ -605,6 +609,9 @@ class SemanticColoringProviderStyling {
|
||||
if (typeof metadata === 'undefined') {
|
||||
metadata = Constants.NO_STYLING;
|
||||
}
|
||||
if (this._logService.getLevel() === LogLevel.Trace) {
|
||||
this._logService.trace(`getTokenStyleMetadata(${tokenType}${tokenModifiers.length ? ', ' + tokenModifiers.join(' ') : ''}): foreground: ${TokenMetadata.getForeground(metadata)}, fontStyle ${TokenMetadata.getFontStyle(metadata).toString(2)}`);
|
||||
}
|
||||
|
||||
this._hashTable.add(tokenTypeIndex, tokenModifierSet, metadata);
|
||||
return metadata;
|
||||
|
||||
@@ -6,19 +6,37 @@
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IPosition } from 'vs/editor/common/core/position';
|
||||
import { IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export const ITextResourceConfigurationService = createDecorator<ITextResourceConfigurationService>('textResourceConfigurationService');
|
||||
export const IResourceConfigurationService = createDecorator<IResourceConfigurationService>('resourceConfigurationService');
|
||||
|
||||
export interface ITextResourceConfigurationService {
|
||||
export interface IResourceConfigurationChangeEvent {
|
||||
|
||||
/**
|
||||
* All affected keys. Also includes language overrides and keys changed under language overrides.
|
||||
*/
|
||||
readonly affectedKeys: string[];
|
||||
|
||||
/**
|
||||
* Returns `true` if the given section has changed for the given resource.
|
||||
*
|
||||
* Example: To check if the configuration section has changed for a given resource use `e.affectsConfiguration(resource, section)`.
|
||||
*
|
||||
* @param resource Resource for which the configuration has to be checked.
|
||||
* @param section Section of the configuration
|
||||
*/
|
||||
affectsConfiguration(resource: URI, section: string): boolean;
|
||||
}
|
||||
|
||||
export interface IResourceConfigurationService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
* Event that fires when the configuration changes.
|
||||
*/
|
||||
onDidChangeConfiguration: Event<IConfigurationChangeEvent>;
|
||||
onDidChangeConfiguration: Event<IResourceConfigurationChangeEvent>;
|
||||
|
||||
/**
|
||||
* Fetches the value of the section for the given resource by applying language overrides.
|
||||
@@ -32,6 +50,20 @@ export interface ITextResourceConfigurationService {
|
||||
getValue<T>(resource: URI | undefined, section?: string): T;
|
||||
getValue<T>(resource: URI | undefined, position?: IPosition, section?: string): T;
|
||||
|
||||
/**
|
||||
* Update the configuration value for the given resource at the effective location.
|
||||
*
|
||||
* - If configurationTarget is not specified, target will be derived by checking where the configuration is defined.
|
||||
* - If the language overrides for the give resource contains the configuration, then it is updated.
|
||||
*
|
||||
* @param resource Resource for which the configuration has to be updated
|
||||
* @param key Configuration key
|
||||
* @param value Configuration value
|
||||
* @param configurationTarget Optional target into which the configuration has to be updated.
|
||||
* If not specified, target will be derived by checking where the configuration is defined.
|
||||
*/
|
||||
updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise<void>;
|
||||
|
||||
}
|
||||
|
||||
export const ITextResourcePropertiesService = createDecorator<ITextResourcePropertiesService>('textResourcePropertiesService');
|
||||
@@ -44,4 +76,4 @@ export interface ITextResourcePropertiesService {
|
||||
* Returns the End of Line characters for the given resource
|
||||
*/
|
||||
getEOL(resource: URI | undefined, language?: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IConfigurationChangeEvent, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IResourceConfigurationService, IResourceConfigurationChangeEvent } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IConfigurationService, ConfigurationTarget, IConfigurationValue, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService {
|
||||
export class TextResourceConfigurationService extends Disposable implements IResourceConfigurationService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
|
||||
private readonly _onDidChangeConfiguration: Emitter<IConfigurationChangeEvent> = this._register(new Emitter<IConfigurationChangeEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<IConfigurationChangeEvent> = this._onDidChangeConfiguration.event;
|
||||
private readonly _onDidChangeConfiguration: Emitter<IResourceConfigurationChangeEvent> = this._register(new Emitter<IResourceConfigurationChangeEvent>());
|
||||
public readonly onDidChangeConfiguration: Event<IResourceConfigurationChangeEvent> = this._onDidChangeConfiguration.event;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@@ -25,7 +25,7 @@ export class TextResourceConfigurationService extends Disposable implements ITex
|
||||
@IModeService private readonly modeService: IModeService,
|
||||
) {
|
||||
super();
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(e)));
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))));
|
||||
}
|
||||
|
||||
getValue<T>(resource: URI, section?: string): T;
|
||||
@@ -37,6 +37,67 @@ export class TextResourceConfigurationService extends Disposable implements ITex
|
||||
return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined);
|
||||
}
|
||||
|
||||
updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise<void> {
|
||||
const language = this.getLanguage(resource, null);
|
||||
const configurationValue = this.configurationService.inspect(key, { resource, overrideIdentifier: language });
|
||||
if (configurationTarget === undefined) {
|
||||
configurationTarget = this.deriveConfigurationTarget(configurationValue, language);
|
||||
}
|
||||
switch (configurationTarget) {
|
||||
case ConfigurationTarget.MEMORY:
|
||||
return this._updateValue(key, value, configurationTarget, configurationValue.memoryTarget?.override, resource, language);
|
||||
case ConfigurationTarget.WORKSPACE_FOLDER:
|
||||
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolderTarget?.override, resource, language);
|
||||
case ConfigurationTarget.WORKSPACE:
|
||||
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceTarget?.override, resource, language);
|
||||
case ConfigurationTarget.USER_REMOTE:
|
||||
return this._updateValue(key, value, configurationTarget, configurationValue.userRemoteTarget?.override, resource, language);
|
||||
default:
|
||||
return this._updateValue(key, value, configurationTarget, configurationValue.userLocalTarget?.override, resource, language);
|
||||
}
|
||||
}
|
||||
|
||||
private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, overriddenValue: any | undefined, resource: URI, language: string | null): Promise<void> {
|
||||
if (language && overriddenValue !== undefined) {
|
||||
return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget);
|
||||
} else {
|
||||
return this.configurationService.updateValue(key, value, { resource }, configurationTarget);
|
||||
}
|
||||
}
|
||||
|
||||
private deriveConfigurationTarget(configurationValue: IConfigurationValue<any>, language: string | null): ConfigurationTarget {
|
||||
if (language) {
|
||||
if (configurationValue.memoryTarget?.override !== undefined) {
|
||||
return ConfigurationTarget.MEMORY;
|
||||
}
|
||||
if (configurationValue.workspaceFolderTarget?.override !== undefined) {
|
||||
return ConfigurationTarget.WORKSPACE_FOLDER;
|
||||
}
|
||||
if (configurationValue.workspaceTarget?.override !== undefined) {
|
||||
return ConfigurationTarget.WORKSPACE;
|
||||
}
|
||||
if (configurationValue.userRemoteTarget?.override !== undefined) {
|
||||
return ConfigurationTarget.USER_REMOTE;
|
||||
}
|
||||
if (configurationValue.userLocalTarget?.override !== undefined) {
|
||||
return ConfigurationTarget.USER_LOCAL;
|
||||
}
|
||||
}
|
||||
if (configurationValue.memoryTarget?.value !== undefined) {
|
||||
return ConfigurationTarget.MEMORY;
|
||||
}
|
||||
if (configurationValue.workspaceFolderTarget?.value !== undefined) {
|
||||
return ConfigurationTarget.WORKSPACE_FOLDER;
|
||||
}
|
||||
if (configurationValue.workspaceTarget?.value !== undefined) {
|
||||
return ConfigurationTarget.WORKSPACE;
|
||||
}
|
||||
if (configurationValue.userRemoteTarget?.value !== undefined) {
|
||||
return ConfigurationTarget.USER_REMOTE;
|
||||
}
|
||||
return ConfigurationTarget.USER_LOCAL;
|
||||
}
|
||||
|
||||
private _getValue<T>(resource: URI, position: IPosition | null, section: string | undefined): T {
|
||||
const language = resource ? this.getLanguage(resource, position) : undefined;
|
||||
if (typeof section === 'undefined') {
|
||||
@@ -51,6 +112,15 @@ export class TextResourceConfigurationService extends Disposable implements ITex
|
||||
return position ? this.modeService.getLanguageIdentifier(model.getLanguageIdAtPosition(position.lineNumber, position.column))!.language : model.getLanguageIdentifier().language;
|
||||
}
|
||||
return this.modeService.getModeIdByFilepathOrFirstLine(resource);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private toResourceConfigurationChangeEvent(configurationChangeEvent: IConfigurationChangeEvent): IResourceConfigurationChangeEvent {
|
||||
return {
|
||||
affectedKeys: configurationChangeEvent.affectedKeys,
|
||||
affectsConfiguration: (resource: URI, configuration: string) => {
|
||||
const overrideIdentifier = this.getLanguage(resource, null);
|
||||
return configurationChangeEvent.affectsConfiguration(configuration, { resource, overrideIdentifier });
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,111 +333,12 @@ export enum CursorChangeReason {
|
||||
Redo = 6
|
||||
}
|
||||
|
||||
export enum AccessibilitySupport {
|
||||
/**
|
||||
* This should be the browser case where it is not known if a screen reader is attached or no.
|
||||
*/
|
||||
Unknown = 0,
|
||||
Disabled = 1,
|
||||
Enabled = 2
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of animation in which the editor's cursor should be rendered.
|
||||
*/
|
||||
export enum TextEditorCursorBlinkingStyle {
|
||||
/**
|
||||
* Hidden
|
||||
*/
|
||||
Hidden = 0,
|
||||
/**
|
||||
* Blinking
|
||||
*/
|
||||
Blink = 1,
|
||||
/**
|
||||
* Blinking with smooth fading
|
||||
*/
|
||||
Smooth = 2,
|
||||
/**
|
||||
* Blinking with prolonged filled state and smooth fading
|
||||
*/
|
||||
Phase = 3,
|
||||
/**
|
||||
* Expand collapse animation on the y axis
|
||||
*/
|
||||
Expand = 4,
|
||||
/**
|
||||
* No-Blinking
|
||||
*/
|
||||
Solid = 5
|
||||
}
|
||||
|
||||
/**
|
||||
* The style in which the editor's cursor should be rendered.
|
||||
*/
|
||||
export enum TextEditorCursorStyle {
|
||||
/**
|
||||
* As a vertical line (sitting between two characters).
|
||||
*/
|
||||
Line = 1,
|
||||
/**
|
||||
* As a block (sitting on top of a character).
|
||||
*/
|
||||
Block = 2,
|
||||
/**
|
||||
* As a horizontal line (sitting under a character).
|
||||
*/
|
||||
Underline = 3,
|
||||
/**
|
||||
* As a thin vertical line (sitting between two characters).
|
||||
*/
|
||||
LineThin = 4,
|
||||
/**
|
||||
* As an outlined block (sitting on top of a character).
|
||||
*/
|
||||
BlockOutline = 5,
|
||||
/**
|
||||
* As a thin horizontal line (sitting under a character).
|
||||
*/
|
||||
UnderlineThin = 6
|
||||
}
|
||||
|
||||
export enum RenderMinimap {
|
||||
None = 0,
|
||||
Text = 1,
|
||||
Blocks = 2
|
||||
}
|
||||
|
||||
export enum RenderLineNumbersType {
|
||||
Off = 0,
|
||||
On = 1,
|
||||
Relative = 2,
|
||||
Interval = 3,
|
||||
Custom = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes how to indent wrapped lines.
|
||||
*/
|
||||
export enum WrappingIndent {
|
||||
/**
|
||||
* No indentation => wrapped lines begin at column 1.
|
||||
*/
|
||||
None = 0,
|
||||
/**
|
||||
* Same => wrapped lines get the same indentation as the parent.
|
||||
*/
|
||||
Same = 1,
|
||||
/**
|
||||
* Indent => wrapped lines get +1 indentation toward the parent.
|
||||
*/
|
||||
Indent = 2,
|
||||
/**
|
||||
* DeepIndent => wrapped lines get +2 indentation toward the parent.
|
||||
*/
|
||||
DeepIndent = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* A positioning preference for rendering content widgets.
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import { MarkerSeverity } from 'vs/platform/markers/common/markers';
|
||||
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
import { registerColor, listErrorForeground, listWarningForeground, foreground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IdleValue } from 'vs/base/common/async';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export type OutlineItem = OutlineGroup | OutlineElement;
|
||||
@@ -282,7 +282,7 @@ export class OutlineFilter implements ITreeFilter<OutlineItem> {
|
||||
|
||||
constructor(
|
||||
private readonly _prefix: string,
|
||||
@ITextResourceConfigurationService private readonly _textResourceConfigService: ITextResourceConfigurationService,
|
||||
@IResourceConfigurationService private readonly _textResourceConfigService: IResourceConfigurationService,
|
||||
) { }
|
||||
|
||||
filter(element: OutlineItem): boolean {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSelections';
|
||||
import { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/modelService.test';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
class MockJSMode extends MockMode {
|
||||
|
||||
@@ -46,7 +47,7 @@ suite('SmartSelect', () => {
|
||||
|
||||
setup(() => {
|
||||
const configurationService = new TestConfigurationService();
|
||||
modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService());
|
||||
modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService(), new NullLogService());
|
||||
mode = new MockJSMode();
|
||||
});
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ import { ITextModel, ITextSnapshot } from 'vs/editor/common/model';
|
||||
import { TextEdit, WorkspaceEdit, isResourceTextEdit } from 'vs/editor/common/modes';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IResolvedTextEditorModel, ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IResourceConfigurationService, ITextResourcePropertiesService, IResourceConfigurationChangeEvent } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { CommandsRegistry, ICommand, ICommandEvent, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel } from 'vs/platform/configuration/common/configuration';
|
||||
import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel, IConfigurationValue, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { Configuration, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfirmation, IConfirmationResult, IDialogOptions, IDialogService, IShowResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
@@ -460,13 +460,7 @@ export class SimpleConfigurationService implements IConfigurationService {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public inspect<C>(key: string, options: IConfigurationOverrides = {}): {
|
||||
default: C,
|
||||
user: C,
|
||||
workspace?: C,
|
||||
workspaceFolder?: C
|
||||
value: C,
|
||||
} {
|
||||
public inspect<C>(key: string, options: IConfigurationOverrides = {}): IConfigurationValue<C> {
|
||||
return this.configuration().inspect<C>(key, options, undefined);
|
||||
}
|
||||
|
||||
@@ -493,16 +487,16 @@ export class SimpleConfigurationService implements IConfigurationService {
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleResourceConfigurationService implements ITextResourceConfigurationService {
|
||||
export class SimpleResourceConfigurationService implements IResourceConfigurationService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private readonly _onDidChangeConfiguration = new Emitter<IConfigurationChangeEvent>();
|
||||
private readonly _onDidChangeConfiguration = new Emitter<IResourceConfigurationChangeEvent>();
|
||||
public readonly onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
||||
|
||||
constructor(private readonly configurationService: SimpleConfigurationService) {
|
||||
this.configurationService.onDidChangeConfiguration((e) => {
|
||||
this._onDidChangeConfiguration.fire(e);
|
||||
this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: (resource: URI, configuration: string) => e.affectsConfiguration(configuration) });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -516,6 +510,10 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur
|
||||
}
|
||||
return this.configurationService.getValue<T>(section);
|
||||
}
|
||||
|
||||
updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise<void> {
|
||||
return this.configurationService.updateValue(key, value, { resource }, configurationTarget);
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleResourcePropertiesService implements ITextResourcePropertiesService {
|
||||
|
||||
@@ -346,9 +346,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
|
||||
remeasureFonts: remeasureFonts,
|
||||
|
||||
// enums
|
||||
AccessibilitySupport: standaloneEnums.AccessibilitySupport,
|
||||
ScrollbarVisibility: standaloneEnums.ScrollbarVisibility,
|
||||
WrappingIndent: standaloneEnums.WrappingIndent,
|
||||
OverviewRulerLane: standaloneEnums.OverviewRulerLane,
|
||||
MinimapPosition: standaloneEnums.MinimapPosition,
|
||||
EndOfLinePreference: standaloneEnums.EndOfLinePreference,
|
||||
@@ -357,13 +355,10 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
|
||||
TrackedRangeStickiness: standaloneEnums.TrackedRangeStickiness,
|
||||
CursorChangeReason: standaloneEnums.CursorChangeReason,
|
||||
MouseTargetType: standaloneEnums.MouseTargetType,
|
||||
TextEditorCursorStyle: standaloneEnums.TextEditorCursorStyle,
|
||||
TextEditorCursorBlinkingStyle: standaloneEnums.TextEditorCursorBlinkingStyle,
|
||||
ContentWidgetPositionPreference: standaloneEnums.ContentWidgetPositionPreference,
|
||||
OverlayWidgetPositionPreference: standaloneEnums.OverlayWidgetPositionPreference,
|
||||
RenderMinimap: standaloneEnums.RenderMinimap,
|
||||
ScrollType: standaloneEnums.ScrollType,
|
||||
RenderLineNumbersType: standaloneEnums.RenderLineNumbersType,
|
||||
|
||||
// classes
|
||||
ConfigurationChangedEvent: <any>ConfigurationChangedEvent,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { SimpleBulkEditService, SimpleConfigurationService, SimpleDialogService, SimpleNotificationService, SimpleEditorProgressService, SimpleResourceConfigurationService, SimpleResourcePropertiesService, SimpleUriLabelService, SimpleWorkspaceContextService, StandaloneCommandService, StandaloneKeybindingService, StandaloneTelemetryService, SimpleLayoutService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { StandaloneCodeEditorServiceImpl } from 'vs/editor/standalone/browser/standaloneCodeServiceImpl';
|
||||
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
|
||||
@@ -126,7 +126,7 @@ export module StaticServices {
|
||||
const configurationServiceImpl = new SimpleConfigurationService();
|
||||
export const configurationService = define(IConfigurationService, () => configurationServiceImpl);
|
||||
|
||||
export const resourceConfigurationService = define(ITextResourceConfigurationService, () => new SimpleResourceConfigurationService(configurationServiceImpl));
|
||||
export const resourceConfigurationService = define(IResourceConfigurationService, () => new SimpleResourceConfigurationService(configurationServiceImpl));
|
||||
|
||||
export const resourcePropertiesService = define(ITextResourcePropertiesService, () => new SimpleResourcePropertiesService(configurationServiceImpl));
|
||||
|
||||
@@ -146,7 +146,9 @@ export module StaticServices {
|
||||
|
||||
export const standaloneThemeService = define(IStandaloneThemeService, () => new StandaloneThemeServiceImpl());
|
||||
|
||||
export const modelService = define(IModelService, (o) => new ModelServiceImpl(configurationService.get(o), resourcePropertiesService.get(o), standaloneThemeService.get(o)));
|
||||
export const logService = define(ILogService, () => new NullLogService());
|
||||
|
||||
export const modelService = define(IModelService, (o) => new ModelServiceImpl(configurationService.get(o), resourcePropertiesService.get(o), standaloneThemeService.get(o), logService.get(o)));
|
||||
|
||||
export const markerDecorationsService = define(IMarkerDecorationsService, (o) => new MarkerDecorationsService(modelService.get(o), markerService.get(o)));
|
||||
|
||||
@@ -156,8 +158,6 @@ export module StaticServices {
|
||||
|
||||
export const storageService = define(IStorageService, () => new InMemoryStorageService());
|
||||
|
||||
export const logService = define(ILogService, () => new NullLogService());
|
||||
|
||||
export const editorWorkerService = define(IEditorWorkerService, (o) => new EditorWorkerServiceImpl(modelService.get(o), resourceConfigurationService.get(o), logService.get(o)));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import { ITextResourcePropertiesService } from 'vs/editor/common/services/resour
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
const GENERATE_TESTS = false;
|
||||
|
||||
@@ -28,7 +29,7 @@ suite('ModelService', () => {
|
||||
configService.setUserConfiguration('files', { 'eol': '\n' });
|
||||
configService.setUserConfiguration('files', { 'eol': '\r\n' }, URI.file(platform.isWindows ? 'c:\\myroot' : '/myroot'));
|
||||
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService());
|
||||
modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService());
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IConfigurationValue, IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { TextResourceConfigurationService } from 'vs/editor/common/services/resourceConfigurationImpl';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
|
||||
suite('TextResourceConfigurationService - Update', () => {
|
||||
|
||||
let configurationValue: IConfigurationValue<any> = {};
|
||||
let updateArgs: any[];
|
||||
let configurationService = new class extends TestConfigurationService {
|
||||
inspect() {
|
||||
return configurationValue;
|
||||
}
|
||||
updateValue() {
|
||||
updateArgs = [...arguments];
|
||||
return Promise.resolve();
|
||||
}
|
||||
}();
|
||||
let language: string | null = null;
|
||||
let testObject: TextResourceConfigurationService;
|
||||
|
||||
setup(() => {
|
||||
const instantiationService = new TestInstantiationService();
|
||||
instantiationService.stub(IModelService, <Partial<IModelService>>{ getModel() { return null; } });
|
||||
instantiationService.stub(IModeService, <Partial<IModeService>>{ getModeIdByFilepathOrFirstLine() { return language; } });
|
||||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
testObject = instantiationService.createInstance(TextResourceConfigurationService);
|
||||
});
|
||||
|
||||
test('updateValue writes without target and overrides when no language is defined', async () => {
|
||||
const resource = URI.file('someFile');
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes with target and without overrides when no language is defined', async () => {
|
||||
const resource = URI.file('someFile');
|
||||
await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.USER_LOCAL);
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes into given memory target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceFolderTarget: { value: '1' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.MEMORY);
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.MEMORY]);
|
||||
});
|
||||
|
||||
test('updateValue writes into given workspace target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceFolderTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.WORKSPACE);
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.WORKSPACE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into given user target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceFolderTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.USER);
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER]);
|
||||
});
|
||||
|
||||
test('updateValue writes into given workspace folder target with overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceFolderTarget: { value: '2', override: '1' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.WORKSPACE_FOLDER);
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE_FOLDER]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived workspace folder target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceFolderTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.WORKSPACE_FOLDER]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived workspace folder target with overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceTarget: { value: '2', override: '1' },
|
||||
workspaceFolderTarget: { value: '2', override: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE_FOLDER]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived workspace target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.WORKSPACE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived workspace target with overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceTarget: { value: '2', override: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived workspace target with overrides and value defined in folder', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1', override: '3' },
|
||||
userLocalTarget: { value: '2' },
|
||||
workspaceTarget: { value: '2', override: '2' },
|
||||
workspaceFolderTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user remote target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
userRemoteTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_REMOTE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user remote target with overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
userRemoteTarget: { value: '2', override: '3' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_REMOTE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user remote target with overrides and value defined in workspace', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
userRemoteTarget: { value: '2', override: '3' },
|
||||
workspaceTarget: { value: '3' }
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_REMOTE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user remote target with overrides and value defined in workspace folder', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2', override: '1' },
|
||||
userRemoteTarget: { value: '2', override: '3' },
|
||||
workspaceTarget: { value: '3' },
|
||||
workspaceFolderTarget: { value: '3' }
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_REMOTE]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user target without overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user target with overrides', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2', override: '3' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', '2');
|
||||
assert.deepEqual(updateArgs, ['a', '2', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user target with overrides and value is defined in remote', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2', override: '3' },
|
||||
userRemoteTarget: { value: '3' }
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', '2');
|
||||
assert.deepEqual(updateArgs, ['a', '2', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user target with overrides and value is defined in workspace', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
userLocalTarget: { value: '2', override: '3' },
|
||||
workspace: { value: '3' }
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', '2');
|
||||
assert.deepEqual(updateArgs, ['a', '2', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue writes into derived user target with overrides and value is defined in workspace folder', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1', override: '3' },
|
||||
userLocalTarget: { value: '2', override: '3' },
|
||||
userRemoteTarget: { value: '3' },
|
||||
workspaceFolder: { value: '3' }
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', '2');
|
||||
assert.deepEqual(updateArgs, ['a', '2', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
test('updateValue when not changed', async () => {
|
||||
language = 'a';
|
||||
configurationValue = {
|
||||
defaultTarget: { value: '1' },
|
||||
};
|
||||
const resource = URI.file('someFile');
|
||||
|
||||
await testObject.updateValue(resource, 'a', 'b');
|
||||
assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_LOCAL]);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user