未验证 提交 6c5cc99c 编写于 作者: K Ken Aoki 提交者: GitHub

Merge branch 'master' into issue##109636

......@@ -4,14 +4,14 @@
"component": {
"type": "git",
"git": {
"name": "language-rust",
"repositoryUrl": "https://github.com/zargony/atom-language-rust",
"commitHash": "7d59e2ad79fbe5925bd2fd3bd3857bf9f421ff6f"
"name": "rust-syntax",
"repositoryUrl": "https://github.com/dustypomerleau/rust-syntax",
"commitHash": "f3eb2221c8c334f1aae1fbc7af9a6c0b753bb29b"
}
},
"license": "MIT",
"description": "The files syntaxes/rust.tmLanguage.json was derived from the Atom package https://atom.io/packages/language-rust.",
"version": "0.4.12"
"description": "A TextMate-style grammar for Rust.",
"version": "0.2.10"
}
],
"version": 1
......
......@@ -5,21 +5,32 @@
"version": "1.0.0",
"publisher": "vscode",
"license": "MIT",
"engines": { "vscode": "*" },
"engines": {
"vscode": "*"
},
"scripts": {
"update-grammar": "node ../../build/npm/update-grammar.js zargony/atom-language-rust grammars/rust.cson ./syntaxes/rust.tmLanguage.json"
"update-grammar": "node ../../build/npm/update-grammar.js dustypomerleau/rust-syntax syntaxes/rust.tmLanguage.json ./syntaxes/rust.tmLanguage.json"
},
"contributes": {
"languages": [{
"id": "rust",
"extensions": [".rs"],
"aliases": ["Rust", "rust"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "rust",
"path": "./syntaxes/rust.tmLanguage.json",
"scopeName":"source.rust"
}]
"languages": [
{
"id": "rust",
"extensions": [
".rs"
],
"aliases": [
"Rust",
"rust"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "rust",
"path": "./syntaxes/rust.tmLanguage.json",
"scopeName": "source.rust"
}
]
}
}
\ No newline at end of file
}
......@@ -22,7 +22,6 @@ set VSCODE_DEV=1
set VSCODE_CLI=1
set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1
set VSCODE_LOGS=
:: Launch Code
......
......@@ -41,7 +41,6 @@ function code() {
export VSCODE_CLI=1
export ELECTRON_ENABLE_STACK_DUMPING=1
export ELECTRON_ENABLE_LOGGING=1
export VSCODE_LOGS=
# Launch Code
exec "$CODE" . --no-sandbox "$@"
......
......@@ -811,7 +811,7 @@ class TypeFilterController<T, TFilterData> implements IDisposable {
const onDragOver = (event: DragEvent) => {
event.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
const x = event.screenX - left;
const x = event.clientX - left;
if (event.dataTransfer) {
event.dataTransfer.dropEffect = 'none';
}
......@@ -954,6 +954,7 @@ export interface IAbstractTreeOptionsUpdate extends ITreeRendererOptions {
readonly smoothScrolling?: boolean;
readonly horizontalScrolling?: boolean;
readonly expandOnlyOnDoubleClick?: boolean;
readonly expandOnlyOnTwistieClick?: boolean | ((e: any) => boolean); // e is T
}
export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTreeOptionsUpdate, IListOptions<T> {
......@@ -961,7 +962,6 @@ export interface IAbstractTreeOptions<T, TFilterData = void> extends IAbstractTr
readonly filter?: ITreeFilter<T, TFilterData>;
readonly dnd?: ITreeDragAndDrop<T>;
readonly keyboardNavigationEventFilter?: IKeyboardNavigationEventFilter;
readonly expandOnlyOnTwistieClick?: boolean | ((e: T) => boolean);
readonly additionalScrollHeight?: number;
}
......@@ -1109,7 +1109,9 @@ class TreeNodeListMouseController<T, TFilterData, TRef> extends MouseController<
expandOnlyOnTwistieClick = !!this.tree.expandOnlyOnTwistieClick;
}
if (expandOnlyOnTwistieClick && !onTwistie) {
const clickedOnFocus = this.tree.getFocus()[0] === node.element;
if (expandOnlyOnTwistieClick && !onTwistie && e.browserEvent.detail !== 2 && !(clickedOnFocus && !node.collapsed)) {
return super.onViewPointer(e);
}
......
......@@ -19,7 +19,6 @@ suite('Processes', () => {
VSCODE_CLI: 'x',
VSCODE_DEV: 'x',
VSCODE_IPC_HOOK: 'x',
VSCODE_LOGS: 'x',
VSCODE_NLS_CONFIG: 'x',
VSCODE_PORTABLE: 'x',
VSCODE_PID: 'x',
......
......@@ -200,7 +200,7 @@ class CodeMain {
VSCODE_IPC_HOOK: environmentService.mainIPCHandle
};
['VSCODE_NLS_CONFIG', 'VSCODE_LOGS', 'VSCODE_PORTABLE'].forEach(key => {
['VSCODE_NLS_CONFIG', 'VSCODE_PORTABLE'].forEach(key => {
const value = process.env[key];
if (typeof value === 'string') {
instanceEnvironment[key] = value;
......
......@@ -370,6 +370,10 @@ export interface IEditorOptions {
* Suggest options.
*/
suggest?: ISuggestOptions;
/**
* Smart select opptions;
*/
smartSelect?: ISmartSelectOptions;
/**
*
*/
......@@ -3430,6 +3434,44 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
//#endregion
//#region smart select
export interface ISmartSelectOptions {
selectLeadingAndTrailingWhitespace?: boolean
}
export type SmartSelectOptions = Readonly<Required<ISmartSelectOptions>>;
class SmartSelect extends BaseEditorOption<EditorOption.smartSelect, SmartSelectOptions> {
constructor() {
super(
EditorOption.smartSelect, 'smartSelect',
{
selectLeadingAndTrailingWhitespace: true
},
{
'editor.smartSelect.selectLeadingAndTrailingWhitespace': {
description: nls.localize('selectLeadingAndTrailingWhitespace', "Whether leading and trailing whitespace should always be selected."),
default: true,
type: 'boolean'
}
}
);
}
public validate(input: any): Readonly<Required<ISmartSelectOptions>> {
if (!input || typeof input !== 'object') {
return this.defaultValue;
}
return {
selectLeadingAndTrailingWhitespace: EditorBooleanOption.boolean((input as ISmartSelectOptions).selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace)
};
}
}
//#endregion
//#region tabFocusMode
class EditorTabFocusMode extends ComputedEditorOption<EditorOption.tabFocusMode, boolean> {
......@@ -3646,6 +3688,7 @@ export const enum EditorOption {
showFoldingControls,
showUnused,
snippetSuggestions,
smartSelect,
smoothScrolling,
stopRenderingLineAfter,
suggest,
......@@ -4165,6 +4208,7 @@ export const EditorOptions = {
description: nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")
}
)),
smartSelect: register(new SmartSelect()),
smoothScrolling: register(new EditorBooleanOption(
EditorOption.smoothScrolling, 'smoothScrolling', false,
{ description: nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.") }
......
......@@ -19,7 +19,7 @@ import { TokenizationRegistryImpl } from 'vs/editor/common/modes/tokenizationReg
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { IMarkerData } from 'vs/platform/markers/common/markers';
import { iconRegistry, Codicon } from 'vs/base/common/codicons';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
/**
* Open ended enum at runtime
* @internal
......@@ -1359,7 +1359,10 @@ export interface WorkspaceEditMetadata {
needsConfirmation: boolean;
label: string;
description?: string;
iconPath?: { id: string } | URI | { light: URI, dark: URI };
/**
* @internal
*/
iconPath?: ThemeIcon | URI | { light: URI, dark: URI };
}
export interface WorkspaceFileEditOptions {
......
......@@ -261,31 +261,32 @@ export enum EditorOption {
showFoldingControls = 91,
showUnused = 92,
snippetSuggestions = 93,
smoothScrolling = 94,
stopRenderingLineAfter = 95,
suggest = 96,
suggestFontSize = 97,
suggestLineHeight = 98,
suggestOnTriggerCharacters = 99,
suggestSelection = 100,
tabCompletion = 101,
tabIndex = 102,
unusualLineTerminators = 103,
useTabStops = 104,
wordSeparators = 105,
wordWrap = 106,
wordWrapBreakAfterCharacters = 107,
wordWrapBreakBeforeCharacters = 108,
wordWrapColumn = 109,
wordWrapMinified = 110,
wrappingIndent = 111,
wrappingStrategy = 112,
showDeprecated = 113,
editorClassName = 114,
pixelRatio = 115,
tabFocusMode = 116,
layoutInfo = 117,
wrappingInfo = 118
smartSelect = 94,
smoothScrolling = 95,
stopRenderingLineAfter = 96,
suggest = 97,
suggestFontSize = 98,
suggestLineHeight = 99,
suggestOnTriggerCharacters = 100,
suggestSelection = 101,
tabCompletion = 102,
tabIndex = 103,
unusualLineTerminators = 104,
useTabStops = 105,
wordSeparators = 106,
wordWrap = 107,
wordWrapBreakAfterCharacters = 108,
wordWrapBreakBeforeCharacters = 109,
wordWrapColumn = 110,
wordWrapMinified = 111,
wrappingIndent = 112,
wrappingStrategy = 113,
showDeprecated = 114,
editorClassName = 115,
pixelRatio = 116,
tabFocusMode = 117,
layoutInfo = 118,
wrappingInfo = 119
}
/**
......
......@@ -23,9 +23,7 @@ import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSe
import { BracketSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/bracketSelections';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { onUnexpectedExternalError } from 'vs/base/common/errors';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { ConfigurationScope, Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
class SelectionRanges {
......@@ -50,49 +48,36 @@ class SelectionRanges {
class SmartSelectController implements IEditorContribution {
public static readonly ID = 'editor.contrib.smartSelectController';
static readonly ID = 'editor.contrib.smartSelectController';
static get(editor: ICodeEditor): SmartSelectController {
return editor.getContribution<SmartSelectController>(SmartSelectController.ID);
}
private readonly _editor: ICodeEditor;
private _state?: SelectionRanges[];
private _selectionListener?: IDisposable;
private _ignoreSelection: boolean = false;
constructor(
editor: ICodeEditor,
@ITextResourceConfigurationService private readonly _configService: ITextResourceConfigurationService,
) {
this._editor = editor;
}
constructor(private readonly _editor: ICodeEditor) { }
dispose(): void {
this._selectionListener?.dispose();
}
run(forward: boolean): Promise<void> | void {
async run(forward: boolean): Promise<void> {
if (!this._editor.hasModel()) {
return;
}
const selections = this._editor.getSelections();
const model = this._editor.getModel();
if (!modes.SelectionRangeRegistry.has(model)) {
return;
}
let promise: Promise<void> = Promise.resolve(undefined);
if (!this._state) {
const selectLeadingAndTrailingWhitespace = this._configService.getValue<boolean>(model.uri, 'editor.smartSelect.selectLeadingAndTrailingWhitespace') ?? true;
promise = provideSelectionRanges(model, selections.map(s => s.getPosition()), { selectLeadingAndTrailingWhitespace }, CancellationToken.None).then(ranges => {
await provideSelectionRanges(model, selections.map(s => s.getPosition()), this._editor.getOption(EditorOption.smartSelect), CancellationToken.None).then(ranges => {
if (!arrays.isNonEmptyArray(ranges) || ranges.length !== selections.length) {
// invalid result
return;
......@@ -125,21 +110,18 @@ class SmartSelectController implements IEditorContribution {
});
}
return promise.then(() => {
if (!this._state) {
// no state
return;
}
this._state = this._state.map(state => state.mov(forward));
const selections = this._state.map(state => Selection.fromPositions(state.ranges[state.index].getStartPosition(), state.ranges[state.index].getEndPosition()));
this._ignoreSelection = true;
try {
this._editor.setSelections(selections);
} finally {
this._ignoreSelection = false;
}
});
if (!this._state) {
// no state
return;
}
this._state = this._state.map(state => state.mov(forward));
const newSelections = this._state.map(state => Selection.fromPositions(state.ranges[state.index].getStartPosition(), state.ranges[state.index].getEndPosition()));
this._ignoreSelection = true;
try {
this._editor.setSelections(newSelections);
} finally {
this._ignoreSelection = false;
}
}
}
......@@ -186,21 +168,6 @@ class GrowSelectionAction extends AbstractSmartSelect {
}
}
//todo@jrieken use proper editor config instead. however, to keep the number
// of changes low use the quick config definition
Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
id: 'editor',
properties: {
'editor.smartSelect.selectLeadingAndTrailingWhitespace': {
scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,
description: nls.localize('selectLeadingAndTrailingWhitespace', "Weather leading and trailing whitespace should always be selected."),
default: true,
type: 'boolean'
}
}
});
// renamed command id
CommandsRegistry.registerCommandAlias('editor.action.smartSelect.grow', 'editor.action.smartSelect.expand');
......@@ -241,7 +208,7 @@ export interface SelectionRangesOptions {
selectLeadingAndTrailingWhitespace: boolean
}
export function provideSelectionRanges(model: ITextModel, positions: Position[], options: SelectionRangesOptions, token: CancellationToken): Promise<Range[][]> {
export async function provideSelectionRanges(model: ITextModel, positions: Position[], options: SelectionRangesOptions, token: CancellationToken): Promise<Range[][]> {
const providers = modes.SelectionRangeRegistry.all(model);
......@@ -271,66 +238,65 @@ export function provideSelectionRanges(model: ITextModel, positions: Position[],
}, onUnexpectedExternalError));
}
return Promise.all(work).then(() => {
await Promise.all(work);
return allRawRanges.map(oneRawRanges => {
return allRawRanges.map(oneRawRanges => {
if (oneRawRanges.length === 0) {
return [];
}
// sort all by start/end position
oneRawRanges.sort((a, b) => {
if (Position.isBefore(a.getStartPosition(), b.getStartPosition())) {
return 1;
} else if (Position.isBefore(b.getStartPosition(), a.getStartPosition())) {
return -1;
} else if (Position.isBefore(a.getEndPosition(), b.getEndPosition())) {
return -1;
} else if (Position.isBefore(b.getEndPosition(), a.getEndPosition())) {
return 1;
} else {
return 0;
}
});
if (oneRawRanges.length === 0) {
return [];
}
// remove ranges that don't contain the former range or that are equal to the
// former range
let oneRanges: Range[] = [];
let last: Range | undefined;
for (const range of oneRawRanges) {
if (!last || (Range.containsRange(range, last) && !Range.equalsRange(range, last))) {
oneRanges.push(range);
last = range;
}
// sort all by start/end position
oneRawRanges.sort((a, b) => {
if (Position.isBefore(a.getStartPosition(), b.getStartPosition())) {
return 1;
} else if (Position.isBefore(b.getStartPosition(), a.getStartPosition())) {
return -1;
} else if (Position.isBefore(a.getEndPosition(), b.getEndPosition())) {
return -1;
} else if (Position.isBefore(b.getEndPosition(), a.getEndPosition())) {
return 1;
} else {
return 0;
}
});
if (!options.selectLeadingAndTrailingWhitespace) {
return oneRanges;
// remove ranges that don't contain the former range or that are equal to the
// former range
let oneRanges: Range[] = [];
let last: Range | undefined;
for (const range of oneRawRanges) {
if (!last || (Range.containsRange(range, last) && !Range.equalsRange(range, last))) {
oneRanges.push(range);
last = range;
}
}
// add ranges that expand trivia at line starts and ends whenever a range
// wraps onto the a new line
let oneRangesWithTrivia: Range[] = [oneRanges[0]];
for (let i = 1; i < oneRanges.length; i++) {
const prev = oneRanges[i - 1];
const cur = oneRanges[i];
if (cur.startLineNumber !== prev.startLineNumber || cur.endLineNumber !== prev.endLineNumber) {
// add line/block range without leading/failing whitespace
const rangeNoWhitespace = new Range(prev.startLineNumber, model.getLineFirstNonWhitespaceColumn(prev.startLineNumber), prev.endLineNumber, model.getLineLastNonWhitespaceColumn(prev.endLineNumber));
if (rangeNoWhitespace.containsRange(prev) && !rangeNoWhitespace.equalsRange(prev) && cur.containsRange(rangeNoWhitespace) && !cur.equalsRange(rangeNoWhitespace)) {
oneRangesWithTrivia.push(rangeNoWhitespace);
}
// add line/block range
const rangeFull = new Range(prev.startLineNumber, 1, prev.endLineNumber, model.getLineMaxColumn(prev.endLineNumber));
if (rangeFull.containsRange(prev) && !rangeFull.equalsRange(rangeNoWhitespace) && cur.containsRange(rangeFull) && !cur.equalsRange(rangeFull)) {
oneRangesWithTrivia.push(rangeFull);
}
if (!options.selectLeadingAndTrailingWhitespace) {
return oneRanges;
}
// add ranges that expand trivia at line starts and ends whenever a range
// wraps onto the a new line
let oneRangesWithTrivia: Range[] = [oneRanges[0]];
for (let i = 1; i < oneRanges.length; i++) {
const prev = oneRanges[i - 1];
const cur = oneRanges[i];
if (cur.startLineNumber !== prev.startLineNumber || cur.endLineNumber !== prev.endLineNumber) {
// add line/block range without leading/failing whitespace
const rangeNoWhitespace = new Range(prev.startLineNumber, model.getLineFirstNonWhitespaceColumn(prev.startLineNumber), prev.endLineNumber, model.getLineLastNonWhitespaceColumn(prev.endLineNumber));
if (rangeNoWhitespace.containsRange(prev) && !rangeNoWhitespace.equalsRange(prev) && cur.containsRange(rangeNoWhitespace) && !cur.equalsRange(rangeNoWhitespace)) {
oneRangesWithTrivia.push(rangeNoWhitespace);
}
// add line/block range
const rangeFull = new Range(prev.startLineNumber, 1, prev.endLineNumber, model.getLineMaxColumn(prev.endLineNumber));
if (rangeFull.containsRange(prev) && !rangeFull.equalsRange(rangeNoWhitespace) && cur.containsRange(rangeFull) && !cur.equalsRange(rangeFull)) {
oneRangesWithTrivia.push(rangeFull);
}
oneRangesWithTrivia.push(cur);
}
return oneRangesWithTrivia;
});
oneRangesWithTrivia.push(cur);
}
return oneRangesWithTrivia;
});
}
......
......@@ -2909,6 +2909,10 @@ declare namespace monaco.editor {
* Suggest options.
*/
suggest?: ISuggestOptions;
/**
* Smart select opptions;
*/
smartSelect?: ISmartSelectOptions;
/**
*
*/
......@@ -3821,6 +3825,12 @@ declare namespace monaco.editor {
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
export interface ISmartSelectOptions {
selectLeadingAndTrailingWhitespace?: boolean;
}
export type SmartSelectOptions = Readonly<Required<ISmartSelectOptions>>;
/**
* Describes how to indent wrapped lines.
*/
......@@ -3945,31 +3955,32 @@ declare namespace monaco.editor {
showFoldingControls = 91,
showUnused = 92,
snippetSuggestions = 93,
smoothScrolling = 94,
stopRenderingLineAfter = 95,
suggest = 96,
suggestFontSize = 97,
suggestLineHeight = 98,
suggestOnTriggerCharacters = 99,
suggestSelection = 100,
tabCompletion = 101,
tabIndex = 102,
unusualLineTerminators = 103,
useTabStops = 104,
wordSeparators = 105,
wordWrap = 106,
wordWrapBreakAfterCharacters = 107,
wordWrapBreakBeforeCharacters = 108,
wordWrapColumn = 109,
wordWrapMinified = 110,
wrappingIndent = 111,
wrappingStrategy = 112,
showDeprecated = 113,
editorClassName = 114,
pixelRatio = 115,
tabFocusMode = 116,
layoutInfo = 117,
wrappingInfo = 118
smartSelect = 94,
smoothScrolling = 95,
stopRenderingLineAfter = 96,
suggest = 97,
suggestFontSize = 98,
suggestLineHeight = 99,
suggestOnTriggerCharacters = 100,
suggestSelection = 101,
tabCompletion = 102,
tabIndex = 103,
unusualLineTerminators = 104,
useTabStops = 105,
wordSeparators = 106,
wordWrap = 107,
wordWrapBreakAfterCharacters = 108,
wordWrapBreakBeforeCharacters = 109,
wordWrapColumn = 110,
wordWrapMinified = 111,
wrappingIndent = 112,
wrappingStrategy = 113,
showDeprecated = 114,
editorClassName = 115,
pixelRatio = 116,
tabFocusMode = 117,
layoutInfo = 118,
wrappingInfo = 119
}
export const EditorOptions: {
acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
......@@ -4067,6 +4078,7 @@ declare namespace monaco.editor {
showUnused: IEditorOption<EditorOption.showUnused, boolean>;
showDeprecated: IEditorOption<EditorOption.showDeprecated, boolean>;
snippetSuggestions: IEditorOption<EditorOption.snippetSuggestions, 'none' | 'top' | 'bottom' | 'inline'>;
smartSelect: IEditorOption<EditorOption.smartSelect, any>;
smoothScrolling: IEditorOption<EditorOption.smoothScrolling, boolean>;
stopRenderingLineAfter: IEditorOption<EditorOption.stopRenderingLineAfter, number>;
suggest: IEditorOption<EditorOption.suggest, InternalSuggestOptions>;
......@@ -6199,12 +6211,6 @@ declare namespace monaco.languages {
needsConfirmation: boolean;
label: string;
description?: string;
iconPath?: {
id: string;
} | Uri | {
light: Uri;
dark: Uri;
};
}
export interface WorkspaceFileEditOptions {
......
......@@ -78,6 +78,7 @@ export interface NativeParsedArgs {
'force-user-env'?: boolean;
'sync'?: 'on' | 'off';
'__sandbox'?: boolean;
'logsPath'?: string;
// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches
'no-proxy-server'?: boolean;
......
......@@ -112,6 +112,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'force-user-env': { type: 'boolean' },
'open-devtools': { type: 'boolean' },
'__sandbox': { type: 'boolean' },
'logsPath': { type: 'string' },
// chromium flags
'no-proxy-server': { type: 'boolean' },
......
......@@ -204,12 +204,11 @@ export class NativeEnvironmentService implements INativeEnvironmentService {
get disableTelemetry(): boolean { return !!this._args['disable-telemetry']; }
constructor(protected _args: NativeParsedArgs) {
if (!process.env['VSCODE_LOGS']) {
if (!_args.logsPath) {
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
_args.logsPath = path.join(this.userDataPath, 'logs', key);
}
this.logsPath = process.env['VSCODE_LOGS']!;
this.logsPath = _args.logsPath;
}
}
......
......@@ -118,14 +118,15 @@ function createScopedContextKeyService(contextKeyService: IContextKeyService, wi
return result;
}
export const multiSelectModifierSettingKey = 'workbench.list.multiSelectModifier';
export const openModeSettingKey = 'workbench.list.openMode';
export const horizontalScrollingKey = 'workbench.list.horizontalScrolling';
export const keyboardNavigationSettingKey = 'workbench.list.keyboardNavigation';
export const automaticKeyboardNavigationSettingKey = 'workbench.list.automaticKeyboardNavigation';
const multiSelectModifierSettingKey = 'workbench.list.multiSelectModifier';
const openModeSettingKey = 'workbench.list.openMode';
const horizontalScrollingKey = 'workbench.list.horizontalScrolling';
const keyboardNavigationSettingKey = 'workbench.list.keyboardNavigation';
const automaticKeyboardNavigationSettingKey = 'workbench.list.automaticKeyboardNavigation';
const treeIndentKey = 'workbench.tree.indent';
const treeRenderIndentGuidesKey = 'workbench.tree.renderIndentGuides';
const listSmoothScrolling = 'workbench.list.smoothScrolling';
const treeExpandOnFolderClick = 'workbench.tree.expandOnFolderClick';
function useAltAsMultipleSelectionModifier(configurationService: IConfigurationService): boolean {
return configurationService.getValue(multiSelectModifierSettingKey) === 'alt';
......@@ -831,7 +832,8 @@ function workbenchTreeDataPreamble<T, TFilterData, TOptions extends IAbstractTre
keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(container, keybindingService),
additionalScrollHeight,
hideTwistiesOfChildlessElements: options.hideTwistiesOfChildlessElements,
expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick'
expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick',
expandOnlyOnTwistieClick: !configurationService.getValue<boolean>(treeExpandOnFolderClick)
} as TOptions
};
}
......@@ -933,6 +935,9 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
if (e.affectsConfiguration(openModeSettingKey)) {
newOptions = { ...newOptions, expandOnlyOnDoubleClick: configurationService.getValue(openModeSettingKey) === 'doubleClick' };
}
if (e.affectsConfiguration(treeExpandOnFolderClick)) {
newOptions = { ...newOptions, expandOnlyOnTwistieClick: !configurationService.getValue<boolean>(treeExpandOnFolderClick) };
}
if (Object.keys(newOptions).length > 0) {
tree.updateOptions(newOptions);
}
......@@ -1036,6 +1041,11 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': true,
markdownDescription: localize('automatic keyboard navigation setting', "Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to `false`, keyboard navigation is only triggered when executing the `list.toggleKeyboardNavigation` command, for which you can assign a keyboard shortcut.")
},
[treeExpandOnFolderClick]: {
type: 'boolean',
default: true,
description: localize('list expand on folder click setting', "Controls whether tree folders are expanded when clicking the folder names."),
}
}
});
......@@ -128,7 +128,7 @@ export class BulkEditPane extends ViewPane {
this._tree = <WorkbenchAsyncDataTree<BulkFileOperations, BulkEditElement, FuzzyScore>>this._instaService.createInstance(
WorkbenchAsyncDataTree, this.id, treeContainer,
new BulkEditDelegate(),
[new TextEditElementRenderer(), this._instaService.createInstance(FileElementRenderer, resourceLabels), new CategoryElementRenderer()],
[this._instaService.createInstance(TextEditElementRenderer), this._instaService.createInstance(FileElementRenderer, resourceLabels), this._instaService.createInstance(CategoryElementRenderer)],
this._treeDataSource,
{
accessibilityProvider: this._instaService.createInstance(BulkEditAccessibilityProvider),
......
......@@ -21,7 +21,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
import type { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { basename } from 'vs/base/common/resources';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { compare } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
......@@ -386,6 +386,8 @@ export class CategoryElementRenderer implements ITreeRenderer<CategoryElement, F
readonly templateId: string = CategoryElementRenderer.id;
constructor(@IThemeService private readonly _themeService: IThemeService) { }
renderTemplate(container: HTMLElement): CategoryElementTemplate {
return new CategoryElementTemplate(container);
}
......@@ -394,12 +396,15 @@ export class CategoryElementRenderer implements ITreeRenderer<CategoryElement, F
template.icon.style.setProperty('--background-dark', null);
template.icon.style.setProperty('--background-light', null);
template.icon.style.color = '';
const { metadata } = node.element.category;
if (ThemeIcon.isThemeIcon(metadata.iconPath)) {
// css
const className = ThemeIcon.asClassName(metadata.iconPath);
template.icon.className = className ? `theme-icon ${className}` : '';
template.icon.style.color = metadata.iconPath.color ? this._themeService.getColorTheme().getColor(metadata.iconPath.color.id)?.toString() ?? '' : '';
} else if (URI.isUri(metadata.iconPath)) {
// background-image
......@@ -532,7 +537,7 @@ class TextEditElementTemplate {
private readonly _icon: HTMLDivElement;
private readonly _label: HighlightedLabel;
constructor(container: HTMLElement) {
constructor(container: HTMLElement, @IThemeService private readonly _themeService: IThemeService) {
container.classList.add('textedit');
this._checkbox = document.createElement('input');
......@@ -597,6 +602,8 @@ class TextEditElementTemplate {
// css
const className = ThemeIcon.asClassName(iconPath);
this._icon.className = className ? `theme-icon ${className}` : '';
this._icon.style.color = iconPath.color ? this._themeService.getColorTheme().getColor(iconPath.color.id)?.toString() ?? '' : '';
} else if (URI.isUri(iconPath)) {
// background-image
......@@ -623,8 +630,10 @@ export class TextEditElementRenderer implements ITreeRenderer<TextEditElement, F
readonly templateId: string = TextEditElementRenderer.id;
constructor(@IThemeService private readonly _themeService: IThemeService) { }
renderTemplate(container: HTMLElement): TextEditElementTemplate {
return new TextEditElementTemplate(container);
return new TextEditElementTemplate(container, this._themeService);
}
renderElement({ element }: ITreeNode<TextEditElement, FuzzyScore>, _index: number, template: TextEditElementTemplate): void {
......
......@@ -76,7 +76,6 @@
}
.explorer-viewlet .explorer-item .monaco-icon-name-container.multiple > .label-name > .monaco-highlighted-label {
padding: 1px;
border-radius: 3px;
}
......
......@@ -217,7 +217,8 @@ export class TOCTree extends WorkbenchObjectTree<SettingsTreeGroupElement> {
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
accessibilityProvider: instantiationService.createInstance(SettingsAccessibilityProvider),
collapseByDefault: true,
horizontalScrolling: false
horizontalScrolling: false,
hideTwistiesOfChildlessElements: true
};
super(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册