Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d

This commit is contained in:
ADS Merger
2020-06-30 04:40:21 +00:00
committed by AzureDataStudio
parent a8a7559229
commit 1388493cc1
602 changed files with 16375 additions and 12940 deletions

View File

@@ -12,7 +12,6 @@ import './inspectEditorTokens/inspectEditorTokens';
import './quickaccess/gotoLineQuickAccess';
import './quickaccess/gotoSymbolQuickAccess';
import './saveParticipants';
import './semanticTokensHelp';
import './toggleColumnSelection';
import './toggleMinimap';
import './toggleMultiCursorModifier';

View File

@@ -29,10 +29,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { ColorThemeData, TokenStyleDefinitions, TokenStyleDefinition, TextMateThemingRuleDefinitions } from 'vs/workbench/services/themes/common/colorThemeData';
import { SemanticTokenRule, TokenStyleData, TokenStyle } from 'vs/platform/theme/common/tokenClassificationRegistry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface IEditorSemanticHighlightingOptions {
enabled?: boolean;
}
import { SEMANTIC_HIGHLIGHTING_SETTING_ID, IEditorSemanticHighlightingOptions } from 'vs/editor/common/services/modelServiceImpl';
class InspectEditorTokensController extends Disposable implements IEditorContribution {
@@ -264,11 +261,11 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
}
private _isSemanticColoringEnabled() {
if (!this._themeService.getColorTheme().semanticHighlighting) {
return false;
const setting = this._configurationService.getValue<IEditorSemanticHighlightingOptions>(SEMANTIC_HIGHLIGHTING_SETTING_ID, { overrideIdentifier: this._model.getLanguageIdentifier().language, resource: this._model.uri })?.enabled;
if (typeof setting === 'boolean') {
return setting;
}
const options = this._configurationService.getValue<IEditorSemanticHighlightingOptions>('editor.semanticHighlighting', { overrideIdentifier: this._model.getLanguageIdentifier().language, resource: this._model.uri });
return options && options.enabled;
return this._themeService.getColorTheme().semanticHighlighting;
}
private _compute(grammar: IGrammar | null, semanticTokens: SemanticTokensResult | null, position: Position): string {

View File

@@ -53,4 +53,4 @@ class InspectKeyMapJSON extends Action {
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(InspectKeyMapJSON), 'Developer: Inspect Key Mappings (JSON)', nls.localize('developer', "Developer"));
registry.registerWorkbenchAction(SyncActionDescriptor.from(InspectKeyMapJSON), 'Developer: Inspect Key Mappings (JSON)', nls.localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"));

View File

@@ -137,7 +137,7 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
picker.busy = true;
provider.provideTableOfContents(pane, cts.token).then(entries => {
provider.provideTableOfContents(pane, { disposables }, cts.token).then(entries => {
picker.busy = false;
@@ -256,7 +256,8 @@ export interface ITableOfContentsEntry {
}
export interface ITableOfContentsProvider<T extends IEditorPane = IEditorPane> {
provideTableOfContents(editor: T, token: CancellationToken): Promise<ITableOfContentsEntry[] | undefined | null>;
provideTableOfContents(editor: T, context: { disposables: DisposableStore }, token: CancellationToken): Promise<ITableOfContentsEntry[] | undefined | null>;
}
class ProviderRegistry {

View File

@@ -1,109 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import * as path from 'vs/base/common/path';
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { URI } from 'vs/base/common/uri';
import { ITextModel } from 'vs/editor/common/model';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
/**
* Shows a message when semantic tokens are shown the first time.
*/
export class SemanticTokensHelp extends Disposable implements IEditorContribution {
public static readonly ID = 'editor.contrib.semanticHighlightHelp';
constructor(
_editor: ICodeEditor,
@INotificationService _notificationService: INotificationService,
@IOpenerService _openerService: IOpenerService,
@IWorkbenchThemeService _themeService: IWorkbenchThemeService,
@IEditorService _editorService: IEditorService,
@IStorageService _storageService: IStorageService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
super();
// opt-in to syncing
const neverShowAgainId = 'editor.contrib.semanticTokensHelp';
if (_storageService.getBoolean(neverShowAgainId, StorageScope.GLOBAL)) {
return;
}
storageKeysSyncRegistryService.registerStorageKey({ key: neverShowAgainId, version: 1 });
const toDispose = this._register(new DisposableStore());
const localToDispose = toDispose.add(new DisposableStore());
const installChangeTokenListener = (model: ITextModel) => {
localToDispose.add(model.onDidChangeTokens((e) => {
if (!e.semanticTokensApplied) {
return;
}
if (_storageService.getBoolean(neverShowAgainId, StorageScope.GLOBAL)) {
toDispose.dispose();
return;
}
const activeEditorControl = _editorService.activeTextEditorControl;
if (!isCodeEditor(activeEditorControl) || activeEditorControl.getModel() !== model) {
return; // only show if model is in the active code editor
}
toDispose.dispose(); // uninstall all listeners, make sure the notification is only shown once per window
_storageService.store(neverShowAgainId, true, StorageScope.GLOBAL); // never show again
const message = nls.localize(
{
key: 'semanticTokensHelp',
comment: [
'Variable 0 will be a file name.',
'Variable 1 will be a theme name.'
]
},
"Code coloring of '{0}' has been updated as the theme '{1}' has [semantic highlighting](https://go.microsoft.com/fwlink/?linkid=2122588) enabled.",
path.basename(model.uri.path), _themeService.getColorTheme().label
);
_notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('learnMoreButton', "Learn More"),
run: () => {
const url = 'https://go.microsoft.com/fwlink/?linkid=2122588';
_openerService.open(URI.parse(url));
}
}
]);
}));
};
const model = _editor.getModel();
if (model !== null) {
installChangeTokenListener(model);
}
toDispose.add(_editor.onDidChangeModel((e) => {
localToDispose.clear();
const model = _editor.getModel();
if (!model) {
return;
}
installChangeTokenListener(model);
}));
}
}
registerEditorContribution(SemanticTokensHelp.ID, SemanticTokensHelp);

View File

@@ -314,7 +314,6 @@ function getSuggestEnabledInputOptions(ariaLabel?: string): IEditorOptions {
cursorWidth: 1,
fontFamily: DEFAULT_FONT_FAMILY,
ariaLabel: ariaLabel || '',
snippetSuggestions: 'none',
suggest: { filterGraceful: false, showIcons: false },
autoClosingBrackets: 'never'

View File

@@ -104,4 +104,4 @@ class StartDebugTextMate extends Action {
}
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(StartDebugTextMate), 'Start Text Mate Syntax Grammar Logging', nls.localize('developer', "Developer"));
registry.registerWorkbenchAction(SyncActionDescriptor.from(StartDebugTextMate), 'Start Text Mate Syntax Grammar Logging', nls.localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"));