Revert "Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)" (#5983)

This reverts commit d15a3fcc98.
This commit is contained in:
Karl Burtram
2019-06-11 12:35:58 -07:00
committed by GitHub
parent 95a50b7892
commit 5a7562a37b
926 changed files with 11394 additions and 19540 deletions

View File

@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
import { Delayer } from 'vs/base/common/async';
import * as DOM from 'vs/base/browser/dom';
import { OS } from 'vs/base/common/platform';
import { dispose, Disposable, toDisposable, IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { dispose, Disposable, toDisposable, IDisposable } from 'vs/base/common/lifecycle';
import { CheckboxActionViewItem } from 'vs/base/browser/ui/checkbox/checkbox';
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
@@ -804,7 +804,7 @@ class KeybindingItemRenderer implements IListRenderer<IKeybindingItemEntry, Keyb
const source = this.instantiationService.createInstance(SourceColumn, parent, this.keybindingsEditor);
const columns: Column[] = [actions, command, keybinding, when, source];
const disposables = combinedDisposable(...columns);
const disposables: IDisposable[] = [...columns];
const elements = columns.map(({ element }) => element);
this.keybindingsEditor.layoutColumns(elements);
@@ -814,7 +814,7 @@ class KeybindingItemRenderer implements IListRenderer<IKeybindingItemEntry, Keyb
return {
parent,
columns,
disposable: disposables
disposable: toDisposable(() => dispose(disposables))
};
}

View File

@@ -23,13 +23,11 @@ import { parseTree, Node } from 'vs/base/common/json';
import { ScanCodeBinding } from 'vs/base/common/scanCode';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { WindowsNativeResolvedKeybinding } from 'vs/workbench/services/keybinding/common/windowsKeyboardMapper';
import { themeColorFromId, ThemeColor, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeService';
import { overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry';
import { IModelDeltaDecoration, ITextModel, TrackedRangeStickiness, OverviewRulerLane } from 'vs/editor/common/model';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KeybindingParser } from 'vs/base/common/keybindingParser';
import Severity from 'vs/base/common/severity';
import { SeverityIcon } from 'vs/platform/severityIcon/common/severityIcon';
const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding");
const NLS_KB_LAYOUT_ERROR_MESSAGE = nls.localize('defineKeybinding.kbLayoutErrorMessage', "You won't be able to produce this key combination under your current keyboard layout.");
@@ -402,8 +400,3 @@ function isInterestingEditorModel(editor: ICodeEditor): boolean {
registerEditorContribution(DefineKeybindingController);
registerEditorCommand(new DefineKeybindingCommand());
registerThemingParticipant((theme, collector) => {
collector.addRule(`.monaco-editor .inlineKeybindingInfo:before { background: url("data:image/svg+xml,${SeverityIcon.getSVGData(Severity.Info, theme)}") -0.1em -0.2em no-repeat; }`);
collector.addRule(`.monaco-editor .inlineKeybindingError:before { background: url("data:image/svg+xml,${SeverityIcon.getSVGData(Severity.Error, theme)}") -0.1em -0.2em no-repeat; }`);
});

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#C5C5C5" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>

Before

Width:  |  Height:  |  Size: 194 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#424242" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>

Before

Width:  |  Height:  |  Size: 194 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}</style></defs><title>configure</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,10.015l-2.238.372,1.318,1.847L12.233,15.08l-1.847-1.318L10.013,16H5.986l-.373-2.237L3.767,15.08.919,12.233l1.319-1.847L0,10.013V5.986l2.238-.373L.919,3.767,3.768.919,5.613,2.238,5.986,0h4.028l.372,2.238L12.233.919,15.08,3.768,13.762,5.613,16,5.986Z"/></g><g id="iconBg"><path class="icon-vs-bg" d="M12.876,9.521,15,9.167V6.834L12.879,6.48a5.12,5.12,0,0,0-.354-.854l1.25-1.75-1.65-1.65L10.373,3.477c-.137-.072-.262-.159-.408-.219s-.3-.087-.444-.133L9.167,1H6.834L6.48,3.121a5.118,5.118,0,0,0-.854.354l-1.75-1.25-1.65,1.65L3.477,5.627c-.072.137-.159.262-.219.408s-.087.3-.133.444L1,6.833V9.166l2.121.354a5.122,5.122,0,0,0,.354.854l-1.25,1.75,1.65,1.65,1.752-1.252c.137.072.262.159.408.22s.3.087.444.133L6.833,15H9.166l.354-2.121a5.121,5.121,0,0,0,.854-.354l1.75,1.25,1.65-1.65-1.252-1.752c.072-.137.159-.263.219-.409S12.83,9.669,12.876,9.521ZM8,10.212A2.212,2.212,0,1,1,10.212,8,2.212,2.212,0,0,1,8,10.212Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}</style></defs><title>configure</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,10.015l-2.238.372,1.318,1.847L12.233,15.08l-1.847-1.318L10.013,16H5.986l-.373-2.237L3.767,15.08.919,12.233l1.319-1.847L0,10.013V5.986l2.238-.373L.919,3.767,3.768.919,5.613,2.238,5.986,0h4.028l.372,2.238L12.233.919,15.08,3.768,13.762,5.613,16,5.986Z"/></g><g id="iconBg"><path class="icon-vs-bg" d="M12.876,9.521,15,9.167V6.834L12.879,6.48a5.12,5.12,0,0,0-.354-.854l1.25-1.75-1.65-1.65L10.373,3.477c-.137-.072-.262-.159-.408-.219s-.3-.087-.444-.133L9.167,1H6.834L6.48,3.121a5.118,5.118,0,0,0-.854.354l-1.75-1.25-1.65,1.65L3.477,5.627c-.072.137-.159.262-.219.408s-.087.3-.133.444L1,6.833V9.166l2.121.354a5.122,5.122,0,0,0,.354.854l-1.25,1.75,1.65,1.65,1.752-1.252c.137.072.262.159.408.22s.3.087.444.133L6.833,15H9.166l.354-2.121a5.121,5.121,0,0,0,.854-.354l1.75,1.25,1.65-1.65-1.252-1.752c.072-.137.159-.263.219-.409S12.83,9.669,12.876,9.521ZM8,10.212A2.212,2.212,0,1,1,10.212,8,2.212,2.212,0,0,1,8,10.212Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.22785 7.35986C2.69078 7.35986 3.01627 7.25136 3.20434 7.03436C3.33454 6.87523 3.39964 6.64376 3.39964 6.33996C3.39964 6.20976 3.38517 6.01808 3.35624 5.76492C3.32731 5.51176 3.31284 5.31646 3.31284 5.17902C3.31284 5.04159 3.30561 4.83544 3.29114 4.56058C3.26221 4.31465 3.24774 4.14105 3.24774 4.03978C3.24774 3.34539 3.45027 2.83183 3.85533 2.49909C4.2604 2.16636 4.83183 2 5.56962 2H6.11212V3.28029H5.83002C5.51175 3.28029 5.28391 3.37071 5.14647 3.55154C5.00904 3.73237 4.94033 4.00362 4.94033 4.36528C4.94033 4.45208 4.95479 4.58228 4.98372 4.75588C5.01266 4.97288 5.02712 5.13924 5.02712 5.25497C5.02712 5.34177 5.03436 5.4792 5.04882 5.66727C5.07776 5.92767 5.09222 6.1302 5.09222 6.27486C5.09222 6.82459 4.97649 7.23689 4.74503 7.51175C4.5425 7.75768 4.22423 7.93128 3.79024 8.03255C4.22423 8.14828 4.5425 8.32188 4.74503 8.55334C4.97649 8.84268 5.09222 9.25497 5.09222 9.79024C5.09222 9.94937 5.07776 10.1591 5.04882 10.4195C5.01989 10.6076 5.00904 10.745 5.01627 10.8318C5.02351 10.9186 5.01266 11.0705 4.98372 11.2875C4.95479 11.4467 4.94033 11.5624 4.94033 11.6347C4.94033 11.9964 5.00904 12.2676 5.14647 12.4485C5.28391 12.6293 5.51175 12.7197 5.83002 12.7197H6.11212V14H5.56962C4.0651 14 3.31284 13.3201 3.31284 11.9602C3.31284 11.4684 3.33816 11.0886 3.38879 10.821C3.43942 10.5533 3.46474 10.1664 3.46474 9.66004C3.46474 8.98011 3.08137 8.64014 2.31465 8.64014L2.22785 7.35986ZM13.7722 8.50995C13.0054 8.50995 12.6221 8.84991 12.6221 9.52984C12.6221 9.66004 12.6329 9.85172 12.6546 10.1049C12.6763 10.358 12.6872 10.5497 12.6872 10.6799C12.7306 10.9548 12.7523 11.3382 12.7523 11.83C12.7523 13.1899 11.9855 13.8698 10.4521 13.8698H9.90958V12.7197H10.17C10.4882 12.7197 10.7161 12.6293 10.8535 12.4485C10.991 12.2676 11.0597 11.9964 11.0597 11.6347C11.0597 11.2731 11.038 10.9982 10.9946 10.8101C10.9946 10.6944 10.9801 10.5244 10.9512 10.3002C10.9222 10.0759 10.9078 9.90597 10.9078 9.79024C10.9078 9.25497 11.0235 8.84268 11.255 8.55334C11.4575 8.32188 11.7758 8.14828 12.2098 8.03255C11.7758 7.93128 11.4575 7.75768 11.255 7.51175C11.0235 7.23689 10.9078 6.82459 10.9078 6.27486C10.9078 6.1302 10.9222 5.92767 10.9512 5.66727C10.9801 5.4792 10.9946 5.34177 10.9946 5.25497C11.038 5.02351 11.0597 4.73418 11.0597 4.38698C11.0597 4.03978 10.9873 3.77939 10.8427 3.60579C10.698 3.43219 10.4738 3.32369 10.17 3.28029H9.90958V2H10.4521C11.1754 2 11.7396 2.16636 12.1447 2.49909C12.5497 2.83183 12.7523 3.34539 12.7523 4.03978C12.7523 4.16998 12.7414 4.36166 12.7197 4.61483C12.698 4.86799 12.6872 5.05967 12.6872 5.18987C12.6438 5.46474 12.6148 5.8481 12.6004 6.33996C12.6148 6.64376 12.6799 6.87523 12.7957 7.03436C12.9837 7.25136 13.3092 7.35986 13.7722 7.35986V8.50995Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.22785 7.35986C2.69078 7.35986 3.01627 7.25136 3.20434 7.03436C3.33454 6.87523 3.39964 6.64376 3.39964 6.33996C3.39964 6.20976 3.38517 6.01808 3.35624 5.76492C3.32731 5.51176 3.31284 5.31646 3.31284 5.17902C3.31284 5.04159 3.30561 4.83544 3.29114 4.56058C3.26221 4.31465 3.24774 4.14105 3.24774 4.03978C3.24774 3.34539 3.45027 2.83183 3.85533 2.49909C4.2604 2.16636 4.83183 2 5.56962 2H6.11212V3.28029H5.83002C5.51175 3.28029 5.28391 3.37071 5.14647 3.55154C5.00904 3.73237 4.94033 4.00362 4.94033 4.36528C4.94033 4.45208 4.95479 4.58228 4.98372 4.75588C5.01266 4.97288 5.02712 5.13924 5.02712 5.25497C5.02712 5.34177 5.03436 5.4792 5.04882 5.66727C5.07776 5.92767 5.09222 6.1302 5.09222 6.27486C5.09222 6.82459 4.97649 7.23689 4.74503 7.51175C4.5425 7.75768 4.22423 7.93128 3.79024 8.03255C4.22423 8.14828 4.5425 8.32188 4.74503 8.55334C4.97649 8.84268 5.09222 9.25497 5.09222 9.79024C5.09222 9.94937 5.07776 10.1591 5.04882 10.4195C5.01989 10.6076 5.00904 10.745 5.01627 10.8318C5.02351 10.9186 5.01266 11.0705 4.98372 11.2875C4.95479 11.4467 4.94033 11.5624 4.94033 11.6347C4.94033 11.9964 5.00904 12.2676 5.14647 12.4485C5.28391 12.6293 5.51175 12.7197 5.83002 12.7197H6.11212V14H5.56962C4.0651 14 3.31284 13.3201 3.31284 11.9602C3.31284 11.4684 3.33816 11.0886 3.38879 10.821C3.43942 10.5533 3.46474 10.1664 3.46474 9.66004C3.46474 8.98011 3.08137 8.64014 2.31465 8.64014L2.22785 7.35986ZM13.7722 8.50995C13.0054 8.50995 12.6221 8.84991 12.6221 9.52984C12.6221 9.66004 12.6329 9.85172 12.6546 10.1049C12.6763 10.358 12.6872 10.5497 12.6872 10.6799C12.7306 10.9548 12.7523 11.3382 12.7523 11.83C12.7523 13.1899 11.9855 13.8698 10.4521 13.8698H9.90958V12.7197H10.17C10.4882 12.7197 10.7161 12.6293 10.8535 12.4485C10.991 12.2676 11.0597 11.9964 11.0597 11.6347C11.0597 11.2731 11.038 10.9982 10.9946 10.8101C10.9946 10.6944 10.9801 10.5244 10.9512 10.3002C10.9222 10.0759 10.9078 9.90597 10.9078 9.79024C10.9078 9.25497 11.0235 8.84268 11.255 8.55334C11.4575 8.32188 11.7758 8.14828 12.2098 8.03255C11.7758 7.93128 11.4575 7.75768 11.255 7.51175C11.0235 7.23689 10.9078 6.82459 10.9078 6.27486C10.9078 6.1302 10.9222 5.92767 10.9512 5.66727C10.9801 5.4792 10.9946 5.34177 10.9946 5.25497C11.038 5.02351 11.0597 4.73418 11.0597 4.38698C11.0597 4.03978 10.9873 3.77939 10.8427 3.60579C10.698 3.43219 10.4738 3.32369 10.17 3.28029H9.90958V2H10.4521C11.1754 2 11.7396 2.16636 12.1447 2.49909C12.5497 2.83183 12.7523 3.34539 12.7523 4.03978C12.7523 4.16998 12.7414 4.36166 12.7197 4.61483C12.698 4.86799 12.6872 5.05967 12.6872 5.18987C12.6438 5.46474 12.6148 5.8481 12.6004 6.33996C12.6148 6.64376 12.6799 6.87523 12.7957 7.03436C12.9837 7.25136 13.3092 7.35986 13.7722 7.35986V8.50995Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M8 1c-3.865 0-7 3.135-7 7s3.135 7 7 7 7-3.135 7-7-3.135-7-7-7zm1 12h-2v-7h2v7zm0-8h-2v-2h2v2z" fill="#1BA1E2"/><path d="M7 6h2v7h-2v-7zm0-1h2v-2h-2v2z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 243 B

View File

@@ -47,6 +47,7 @@
display:inline-block;
height:0.8em;
width:1em;
background: url(info.svg) 0px -0.1em no-repeat;
background-size: 0.9em;
}
@@ -56,6 +57,7 @@
display:inline-block;
height:0.8em;
width:1em;
background: url(status-error.svg) 0px -0.1em no-repeat;
background-size: 1em;
}

View File

@@ -1,4 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 2H9V3H10V3.586V4V4.414V6H13V13H5V8H4V14H14V5L11 2Z" fill="#C5C5C5"/>
<path d="M7.08971 4.65186L8 4.50014V3.50029L7.091 3.34857C7.05157 3.22225 7.00079 3.09975 6.93929 2.98257L7.475 2.23257L6.76786 1.52543L6.017 2.06157C5.95829 2.03071 5.90471 1.99343 5.84214 1.96771C5.77957 1.942 5.71357 1.93043 5.65186 1.91071L5.50014 1H4.50029L4.34857 1.909C4.22224 1.94843 4.09974 1.99921 3.98257 2.06071L3.23257 1.525L2.52543 2.23214L3.06157 2.983C3.03071 3.04171 2.99343 3.09529 2.96771 3.15786C2.942 3.22043 2.93043 3.28643 2.91071 3.34814L2 3.49986V4.49971L2.909 4.65143C2.94844 4.77775 2.99921 4.90025 3.06071 5.01743L2.525 5.76743L3.23214 6.47457L3.983 5.938C4.04171 5.96886 4.09529 6.00614 4.15786 6.03229C4.22043 6.05843 4.28643 6.06957 4.34814 6.08929L4.49986 7H5.49971L5.65143 6.091C5.77775 6.05157 5.90025 6.00079 6.01743 5.93929L6.76743 6.475L7.47457 5.76786L6.938 5.017C6.96886 4.95829 7.00614 4.90429 7.03186 4.84171C7.05757 4.77914 7.07 4.71529 7.08971 4.65186ZM5 4.948C4.8125 4.948 4.62922 4.8924 4.47332 4.78823C4.31742 4.68407 4.19591 4.53601 4.12416 4.36278C4.05241 4.18956 4.03364 3.99895 4.07022 3.81505C4.10679 3.63116 4.19708 3.46224 4.32966 3.32966C4.46224 3.19708 4.63116 3.10679 4.81505 3.07022C4.99895 3.03364 5.18956 3.05241 5.36278 3.12416C5.53601 3.19591 5.68407 3.31742 5.78823 3.47332C5.8924 3.62922 5.948 3.8125 5.948 4C5.948 4.25143 5.84812 4.49255 5.67034 4.67034C5.49255 4.84812 5.25143 4.948 5 4.948Z" fill="#75BEFF"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,4 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 2H9V3H10V3.586V4V4.414V6H13V13H5V8H4V14H14V5L11 2Z" fill="#656565"/>
<path d="M7.08971 4.65186L8 4.50014V3.50029L7.091 3.34857C7.05157 3.22225 7.00079 3.09975 6.93929 2.98257L7.475 2.23257L6.76786 1.52543L6.017 2.06157C5.95829 2.03071 5.90471 1.99343 5.84214 1.96771C5.77957 1.942 5.71357 1.93043 5.65186 1.91071L5.50014 1H4.50029L4.34857 1.909C4.22224 1.94843 4.09974 1.99921 3.98257 2.06071L3.23257 1.525L2.52543 2.23214L3.06157 2.983C3.03071 3.04171 2.99343 3.09529 2.96771 3.15786C2.942 3.22043 2.93043 3.28643 2.91071 3.34814L2 3.49986V4.49971L2.909 4.65143C2.94844 4.77775 2.99921 4.90025 3.06071 5.01743L2.525 5.76743L3.23214 6.47457L3.983 5.938C4.04171 5.96886 4.09529 6.00614 4.15786 6.03229C4.22043 6.05843 4.28643 6.06957 4.34814 6.08929L4.49986 7H5.49971L5.65143 6.091C5.77775 6.05157 5.90025 6.00079 6.01743 5.93929L6.76743 6.475L7.47457 5.76786L6.938 5.017C6.96886 4.95829 7.00614 4.90429 7.03186 4.84171C7.05757 4.77914 7.07 4.71529 7.08971 4.65186ZM5 4.948C4.8125 4.948 4.62922 4.8924 4.47332 4.78823C4.31742 4.68407 4.19591 4.53601 4.12416 4.36278C4.05241 4.18956 4.03364 3.99895 4.07022 3.81505C4.10679 3.63116 4.19708 3.46224 4.32966 3.32966C4.46224 3.19708 4.63116 3.10679 4.81505 3.07022C4.99895 3.03364 5.18956 3.05241 5.36278 3.12416C5.53601 3.19591 5.68407 3.31742 5.78823 3.47332C5.8924 3.62922 5.948 3.8125 5.948 4C5.948 4.25143 5.84812 4.49255 5.67034 4.67034C5.49255 4.84812 5.25143 4.948 5 4.948Z" fill="#00539C"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -236,6 +236,15 @@
background: url('edit_inverse.svg') center center no-repeat;
}
.monaco-editor .unsupportedWorkbenhSettingInfo:before {
content:" ";
display:inline-block;
height:1em;
width:1em;
background: url(info.svg) 50% 50% no-repeat;
background-size: 0.9em;
}
.monaco-editor .dim-configuration {
color: #b1b1b1;
}

View File

@@ -1,516 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.editor-instance#workbench\.editor\.settings2:focus {
outline: none;
}
.settings-editor {
padding: 11px 0px 0px;
overflow: hidden;
}
/* header styling */
.settings-editor > .settings-header {
box-sizing: border-box;
margin: auto;
overflow: hidden;
padding-top: 3px;
padding-left: 24px;
padding-right: 24px;
max-width: 1000px;
}
.settings-editor > .settings-header > .search-container {
position: relative;
}
.vs .settings-editor > .settings-header > .search-container > .suggest-input-container {
border: 1px solid #ddd;
}
.settings-editor > .settings-header > .search-container > .settings-count-widget {
margin: 6px 0px;
padding: 0px 8px;
border-radius: 2px;
position: absolute;
right: 10px;
top: 0;
}
.settings-editor > .settings-header > .settings-header-controls {
height: 32px;
display: flex;
border-bottom: solid 1px;
margin-top: 10px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget .action-label {
opacity: 0.9;
}
.settings-editor .settings-tabs-widget > .monaco-action-bar .action-item .action-details {
opacity: 0.9;
}
.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget .action-label:hover {
opacity: 1;
}
.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget .action-label.checked {
opacity: 1;
}
.vs .settings-editor > .settings-header > .settings-header-controls {
border-color: #cccccc;
}
.vs-dark .settings-editor > .settings-header > .settings-header-controls {
border-color: #3c3c3c;
}
.settings-editor > .settings-header .settings-tabs-widget > .monaco-action-bar .action-item .action-label {
margin-right: 0px;
}
.settings-editor > .settings-header .settings-tabs-widget .monaco-action-bar .action-item .dropdown-icon {
/** The tab widget container height is shorter than elsewhere, need to tweak this */
padding-top: 3px;
}
.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item {
padding: 0px;
/* padding must be on action-label because it has the bottom-border, because that's where the .checked class is */
}
.settings-editor > .settings-header > .settings-header-controls .settings-tabs-widget > .monaco-action-bar .action-item .action-label {
text-transform: none;
font-size: 13px;
padding-bottom: 7px;
padding-top: 7px;
padding-left: 8px;
padding-right: 8px;
}
.settings-editor > .settings-body {
position: relative;
}
.settings-editor > .settings-body > .no-results-message {
display: none;
max-width: 1000px;
margin: auto;
margin-top: 20px;
padding-left: 24px;
padding-right: 24px;
box-sizing: border-box;
}
.settings-editor.no-results > .settings-body .settings-toc-container,
.settings-editor.no-results > .settings-body .settings-tree-container {
display: none;
}
.settings-editor.no-results > .settings-body > .no-results-message {
display: block;
}
.settings-editor > .settings-body > .no-results-message a.prominent {
text-decoration: underline;
}
.settings-editor.no-toc-search > .settings-body .settings-tree-container .monaco-list-row .monaco-tl-contents,
.settings-editor.narrow-width > .settings-body .settings-tree-container .monaco-list-row .monaco-tl-contents {
padding-left: 33px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .monaco-tl-twistie {
/* Hide twisties */
display: none !important;
}
.settings-editor.mid-width > .settings-body > .settings-tree-container .shadow.top {
left: 0;
width: calc(100% - 48px);
margin-left: 24px;
}
.settings-editor > .settings-body > .settings-tree-container .shadow.top {
left: 50%;
max-width: 952px;
/* 1000 - 24*2 padding */
margin-left: -476px;
z-index: 1000;
}
.settings-editor > .settings-body .settings-tree-container .setting-toolbar-container {
position: absolute;
left: -32px;
top: 11px;
bottom: 0px;
width: 26px;
}
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .mouseover .setting-toolbar-container > .monaco-toolbar .toolbar-toggle-more,
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-item.focused .setting-toolbar-container > .monaco-toolbar .toolbar-toggle-more,
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-toolbar-container:hover > .monaco-toolbar .toolbar-toggle-more,
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .setting-toolbar-container > .monaco-toolbar .active .toolbar-toggle-more {
opacity: 1;
}
.settings-editor > .settings-body .settings-tree-container .setting-toolbar-container > .monaco-toolbar .toolbar-toggle-more {
opacity: 0;
transition: opacity .3s;
width: 22px;
height: 22px;
background-position: center;
background-repeat: no-repeat;
background-size: 16px;
}
.vs .settings-editor > .settings-body .settings-tree-container .monaco-toolbar .toolbar-toggle-more {
background-image: url('configure.svg');
}
.vs-dark .settings-editor > .settings-body .settings-tree-container .monaco-toolbar .toolbar-toggle-more {
background-image: url('configure-inverse.svg');
}
.settings-editor > .settings-body .settings-toc-container {
width: 100%;
pointer-events: none;
z-index: 100;
position: absolute;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list {
width: 160px;
pointer-events: initial;
}
.settings-editor.no-toc-search > .settings-body .settings-toc-container,
.settings-editor.narrow-width > .settings-body .settings-toc-container {
display: none;
}
.settings-editor > .settings-body .settings-toc-container .monaco-scrollable-element > .shadow {
display: none;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .monaco-tl-contents {
display: flex;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .settings-toc-entry {
overflow: hidden;
text-overflow: ellipsis;
line-height: 22px;
opacity: 0.9;
flex-shrink: 1;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .settings-toc-count {
display: none;
line-height: 22px;
opacity: 0.7;
margin-left: 3px;
}
.settings-editor.search-mode > .settings-body .settings-toc-container .monaco-list-row .settings-toc-count {
display: block;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row .monaco-tl-twistie {
opacity: 0.9;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row.selected .monaco-tl-twistie {
opacity: 1;
}
.settings-editor > .settings-body .settings-toc-container .monaco-list-row.selected .settings-toc-entry {
font-weight: bold;
opacity: 1;
}
.settings-editor > .settings-body .settings-tree-container {
margin-right: 1px;
/* So the item doesn't blend into the edge of the view container */
margin-top: 14px;
border-spacing: 0;
border-collapse: separate;
position: relative;
}
.settings-editor > .settings-body .settings-toc-wrapper {
padding-left: 31px;
}
.settings-editor > .settings-body .settings-toc-wrapper {
height: 100%;
max-width: 1000px;
margin: auto;
}
.settings-editor.no-toc-search > .settings-body .settings-tree-container,
.settings-editor.narrow-width > .settings-body .settings-tree-container {
margin-left: 0px;
}
.settings-editor > .settings-body > .settings-tree-container .monaco-list-row {
line-height: 1.4em !important;
/* so validation messages don't get clipped */
overflow: visible;
cursor: default;
}
.settings-editor > .settings-body .settings-tree-container .monaco-list-rows {
overflow: visible !important; /* Allow validation errors to flow out of the tree container. Override inline style from ScrollableElement. */
}
.settings-editor > .settings-body .settings-tree-container .monaco-list-row .monaco-tl-contents {
max-width: 1000px;
margin: auto;
box-sizing: border-box;
padding-left: 217px;
padding-right: 20px;
overflow: visible;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents {
position: relative;
padding-top: 12px;
padding-bottom: 18px;
white-space: normal;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
/* size to contents for hover to show context button */
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-modified-indicator {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents.is-configured .setting-item-modified-indicator {
display: block;
content: ' ';
position: absolute;
width: 6px;
border-left-width: 2px;
border-left-style: solid;
left: -9px;
top: 15px;
bottom: 16px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-item-contents.is-configured .setting-item-modified-indicator {
bottom: 23px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-title .setting-item-overrides {
opacity: 0.5;
font-style: italic;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-title .setting-item-overrides a.modified-scope {
text-decoration: underline;
cursor: pointer;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-label {
margin-right: 7px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-cat-label-container {
float: left;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-label,
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-category {
font-weight: 600;
user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-category {
opacity: 0.9;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-deprecation-message {
margin-top: 3px;
user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description {
margin-top: -1px;
user-select: text;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-deprecation-message {
position: absolute;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-validation-message {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item .setting-item-contents.invalid-input .setting-item-validation-message {
display: block;
position: absolute;
padding: 5px;
box-sizing: border-box;
margin-top: -1px;
z-index: 1;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-text .setting-item-validation-message {
width: 500px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-number .setting-item-validation-message {
width: 200px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-number input[type=number]::-webkit-inner-spin-button {
/* Hide arrow button that shows in type=number fields */
-webkit-appearance: none !important;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description-markdown * {
margin: 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description-markdown a:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description-markdown a:hover {
text-decoration: underline;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-description-markdown code {
line-height: 15px;
/** For some reason, this is needed, otherwise <code> will take up 20px height */
font-family: var(--monaco-monospace-font);
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-enumDescription {
display: none;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-enumDescription {
display: block;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-item-contents {
padding-bottom: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-item-value-description {
display: flex;
cursor: pointer;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-value-checkbox {
height: 18px;
width: 18px;
border: 1px solid transparent;
border-radius: 3px;
margin-right: 9px;
margin-left: 0px;
padding: 0px;
background-size: 16px !important;
}
.vs .settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-value-checkbox.checked {
background: url('check.svg') center center no-repeat;
}
.vs-dark .settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-value-checkbox.checked,
.hc-black .settings-editor > .settings-body > .settings-tree-container .setting-item-bool .setting-value-checkbox.checked {
background: url('check-inverse.svg') center center no-repeat;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-value {
margin-top: 9px;
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-number .setting-item-value > .setting-item-control {
min-width: 200px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-text .setting-item-control {
width: 500px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-enum .setting-item-value > .setting-item-control,
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-text .setting-item-value > .setting-item-control {
min-width: initial;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item.setting-item-enum .setting-item-value > .setting-item-control > select {
width: 320px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-value .edit-in-settings-button,
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-value .edit-in-settings-button:hover,
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .setting-item-value .edit-in-settings-button:active {
text-align: left;
text-decoration: underline;
padding-left: 0px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-contents .monaco-select-box {
width: initial;
font: inherit;
height: 26px;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-new-extensions {
display: flex;
}
.settings-editor > .settings-body > .settings-tree-container .setting-item-new-extensions .settings-new-extensions-button {
margin: auto;
width: initial;
padding: 4px 10px;
}
.settings-editor > .settings-body > .settings-tree-container .group-title {
cursor: default;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-title-label {
margin: 0px;
font-weight: 600;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-level-1 {
padding-top: 23px;
font-size: 24px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-level-2 {
padding-top: 32px;
font-size: 20px;
}
.settings-editor > .settings-body > .settings-tree-container .settings-group-level-1.settings-group-first {
padding-top: 7px;
}
.settings-editor.search-mode > .settings-body .settings-toc-container .monaco-list-row .settings-toc-count {
display: block;
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle cx="8" cy="8" r="6" fill="#F6F6F6"/><path d="M8 3C5.238 3 3 5.238 3 8s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5zm3 7l-1 1-2-2-2 2-1-1 2-2.027L5 6l1-1 2 2 2-2 1 1-2 1.973L11 10z" fill="#E51400"/><path fill="#fff" d="M11 6l-1-1-2 2-2-2-1 1 2 1.973L5 10l1 1 2-2 2 2 1-1-2-2.027z"/></svg>

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -1,820 +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 { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import 'vs/css!../browser/media/preferences';
import { Command } from 'vs/editor/browser/editorExtensions';
import { Context as SuggestContext } from 'vs/editor/contrib/suggest/suggest';
import * as nls from 'vs/nls';
import { MenuId, MenuRegistry, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { WorkbenchStateContext, RemoteAuthorityContext } from 'vs/workbench/browser/contextkeys';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } from 'vs/workbench/browser/editor';
import { Extensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { EditorInput, Extensions as EditorInputExtensions, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
import { ResourceContextKey } from 'vs/workbench/common/resources';
import { KeybindingsEditor } from 'vs/workbench/contrib/preferences/browser/keybindingsEditor';
import { ConfigureLanguageBasedSettingsAction, OpenDefaultKeybindingsFileAction, OpenFolderSettingsAction, OpenGlobalKeybindingsAction, OpenGlobalKeybindingsFileAction, OpenGlobalSettingsAction, OpenRawDefaultSettingsAction, OpenSettings2Action, OpenSettingsJsonAction, OpenWorkspaceSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OPEN_FOLDER_SETTINGS_LABEL, OpenRemoteSettingsAction } from 'vs/workbench/contrib/preferences/browser/preferencesActions';
import { PreferencesEditor } from 'vs/workbench/contrib/preferences/browser/preferencesEditor';
import { CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, CONTEXT_KEYBINDING_FOCUS, CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_JSON_EDITOR, CONTEXT_SETTINGS_SEARCH_FOCUS, CONTEXT_TOC_ROW_FOCUS, IKeybindingsEditor, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_SEARCH, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE, KEYBINDINGS_EDITOR_SHOW_DEFAULT_KEYBINDINGS, KEYBINDINGS_EDITOR_SHOW_USER_KEYBINDINGS, MODIFIED_SETTING_TAG, SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, SETTINGS_EDITOR_COMMAND_FILTER_MODIFIED, SETTINGS_EDITOR_COMMAND_FILTER_ONLINE, SETTINGS_EDITOR_COMMAND_FOCUS_FILE, SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST, SETTINGS_EDITOR_COMMAND_SEARCH, SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU, SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON, SETTINGS_COMMAND_OPEN_SETTINGS, KEYBINDINGS_EDITOR_COMMAND_DEFINE_WHEN } from 'vs/workbench/contrib/preferences/common/preferences';
import { PreferencesContribution } from 'vs/workbench/contrib/preferences/common/preferencesContribution';
import { SettingsEditor2 } from 'vs/workbench/contrib/preferences/browser/settingsEditor2';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import { DefaultPreferencesEditorInput, KeybindingsEditorInput, PreferencesEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { ExplorerRootContext, ExplorerFolderContext } from 'vs/workbench/contrib/files/common/files';
import { ILabelService } from 'vs/platform/label/common/label';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
PreferencesEditor,
PreferencesEditor.ID,
nls.localize('defaultPreferencesEditor', "Default Preferences Editor")
),
[
new SyncDescriptor(PreferencesEditorInput)
]
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
SettingsEditor2,
SettingsEditor2.ID,
nls.localize('settingsEditor2', "Settings Editor 2")
),
[
new SyncDescriptor(SettingsEditor2Input)
]
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
KeybindingsEditor,
KeybindingsEditor.ID,
nls.localize('keybindingsEditor', "Keybindings Editor")
),
[
new SyncDescriptor(KeybindingsEditorInput)
]
);
interface ISerializedPreferencesEditorInput {
name: string;
description: string;
detailsSerialized: string;
masterSerialized: string;
detailsTypeId: string;
masterTypeId: string;
}
// Register Preferences Editor Input Factory
class PreferencesEditorInputFactory implements IEditorInputFactory {
serialize(editorInput: EditorInput): string | undefined {
const input = <PreferencesEditorInput>editorInput;
if (input.details && input.master) {
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
const detailsInputFactory = registry.getEditorInputFactory(input.details.getTypeId());
const masterInputFactory = registry.getEditorInputFactory(input.master.getTypeId());
if (detailsInputFactory && masterInputFactory) {
const detailsSerialized = detailsInputFactory.serialize(input.details);
const masterSerialized = masterInputFactory.serialize(input.master);
if (detailsSerialized && masterSerialized) {
return JSON.stringify(<ISerializedPreferencesEditorInput>{
name: input.getName(),
description: input.getDescription(),
detailsSerialized,
masterSerialized,
detailsTypeId: input.details.getTypeId(),
masterTypeId: input.master.getTypeId()
});
}
}
}
return undefined;
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | undefined {
const deserialized: ISerializedPreferencesEditorInput = JSON.parse(serializedEditorInput);
const registry = Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories);
const detailsInputFactory = registry.getEditorInputFactory(deserialized.detailsTypeId);
const masterInputFactory = registry.getEditorInputFactory(deserialized.masterTypeId);
if (detailsInputFactory && masterInputFactory) {
const detailsInput = detailsInputFactory.deserialize(instantiationService, deserialized.detailsSerialized);
const masterInput = masterInputFactory.deserialize(instantiationService, deserialized.masterSerialized);
if (detailsInput && masterInput) {
return new PreferencesEditorInput(deserialized.name, deserialized.description, detailsInput, masterInput);
}
}
return undefined;
}
}
class KeybindingsEditorInputFactory implements IEditorInputFactory {
serialize(editorInput: EditorInput): string {
const input = <KeybindingsEditorInput>editorInput;
return JSON.stringify({
name: input.getName(),
typeId: input.getTypeId()
});
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
return instantiationService.createInstance(KeybindingsEditorInput);
}
}
interface ISerializedSettingsEditor2EditorInput {
}
class SettingsEditor2InputFactory implements IEditorInputFactory {
serialize(input: SettingsEditor2Input): string {
const serialized: ISerializedSettingsEditor2EditorInput = {
};
return JSON.stringify(serialized);
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): SettingsEditor2Input {
return instantiationService.createInstance(
SettingsEditor2Input);
}
}
interface ISerializedDefaultPreferencesEditorInput {
resource: string;
}
// Register Default Preferences Editor Input Factory
class DefaultPreferencesEditorInputFactory implements IEditorInputFactory {
serialize(editorInput: EditorInput): string {
const input = <DefaultPreferencesEditorInput>editorInput;
const serialized: ISerializedDefaultPreferencesEditorInput = { resource: input.getResource().toString() };
return JSON.stringify(serialized);
}
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
const deserialized: ISerializedDefaultPreferencesEditorInput = JSON.parse(serializedEditorInput);
return instantiationService.createInstance(DefaultPreferencesEditorInput, URI.parse(deserialized.resource));
}
}
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(PreferencesEditorInput.ID, PreferencesEditorInputFactory);
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(DefaultPreferencesEditorInput.ID, DefaultPreferencesEditorInputFactory);
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(KeybindingsEditorInput.ID, KeybindingsEditorInputFactory);
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(SettingsEditor2Input.ID, SettingsEditor2InputFactory);
// Contribute Global Actions
const category = nls.localize('preferences', "Preferences");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultSettingsAction, OpenRawDefaultSettingsAction.ID, OpenRawDefaultSettingsAction.LABEL), 'Preferences: Open Raw Default Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsJsonAction, OpenSettingsJsonAction.ID, OpenSettingsJsonAction.LABEL), 'Preferences: Open Settings (JSON)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (UI)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsAction, OpenGlobalKeybindingsAction.ID, OpenGlobalKeybindingsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_S) }), 'Preferences: Open Keyboard Shortcuts', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDefaultKeybindingsFileAction, OpenDefaultKeybindingsFileAction.ID, OpenDefaultKeybindingsFileAction.LABEL), 'Preferences: Open Default Keyboard Shortcuts File', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL, { primary: 0 }), 'Preferences: Open Keyboard Shortcuts File', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureLanguageBasedSettingsAction, ConfigureLanguageBasedSettingsAction.ID, ConfigureLanguageBasedSettingsAction.LABEL), 'Preferences: Configure Language Specific Settings...', category);
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: SETTINGS_COMMAND_OPEN_SETTINGS,
weight: KeybindingWeight.WorkbenchContrib,
when: null,
primary: KeyMod.CtrlCmd | KeyCode.US_COMMA,
handler: (accessor, args: string | undefined) => {
accessor.get(IPreferencesService).openSettings(undefined, typeof args === 'string' ? args : undefined);
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_DEFINE,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K),
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.defineKeybinding(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_DEFINE_WHEN,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_E),
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor && control.activeKeybindingEntry!.keybindingItem.keybinding) {
control.defineWhenExpression(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_REMOVE,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: KeyCode.Delete,
mac: {
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.Backspace)
},
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.removeKeybinding(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_RESET,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: 0,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.resetKeybinding(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_SEARCH,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
primary: KeyMod.CtrlCmd | KeyCode.KEY_F,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.focusSearch();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS),
primary: KeyMod.Alt | KeyCode.KEY_K,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_K },
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.recordSearchKeys();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_SORTBY_PRECEDENCE,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
primary: KeyMod.Alt | KeyCode.KEY_P,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P },
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
control.toggleSortByPrecedence();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: 0,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.showSimilarKeybindings(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_COPY,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: KeyMod.CtrlCmd | KeyCode.KEY_C,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.copyKeybinding(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
primary: 0,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.copyKeybindingCommand(control.activeKeybindingEntry!);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS),
primary: KeyCode.DownArrow,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.focusKeybindings();
}
}
});
class PreferencesActionsContribution extends Disposable implements IWorkbenchContribution {
constructor(
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IWorkspaceContextService private readonly workpsaceContextService: IWorkspaceContextService,
@ILabelService labelService: ILabelService,
@IExtensionService extensionService: IExtensionService,
) {
super();
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: OpenGlobalKeybindingsAction.ID,
title: OpenGlobalKeybindingsAction.LABEL,
iconLocation: {
light: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor.svg`)),
dark: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor-inverse.svg`))
}
},
when: ResourceContextKey.Resource.isEqualTo(URI.file(environmentService.appKeybindingsPath).toString()),
group: 'navigation',
order: 1
});
const commandId = '_workbench.openUserSettingsEditor';
CommandsRegistry.registerCommand(commandId, () => this.preferencesService.openGlobalSettings(false));
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor.svg`)),
dark: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor-inverse.svg`))
}
},
when: ResourceContextKey.Resource.isEqualTo(environmentService.settingsResource.toString()),
group: 'navigation',
order: 1
});
this.updatePreferencesEditorMenuItem();
this._register(workpsaceContextService.onDidChangeWorkbenchState(() => this.updatePreferencesEditorMenuItem()));
this._register(workpsaceContextService.onDidChangeWorkspaceFolders(() => this.updatePreferencesEditorMenuItemForWorkspaceFolders()));
extensionService.whenInstalledExtensionsRegistered()
.then(() => {
const remoteAuthority = environmentService.configuration.remoteAuthority;
const hostLabel = labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAuthority) || remoteAuthority;
const label = nls.localize('openRemoteSettings', "Open Remote Settings ({0})", hostLabel);
CommandsRegistry.registerCommand(OpenRemoteSettingsAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenRemoteSettingsAction, OpenRemoteSettingsAction.ID, label).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: OpenRemoteSettingsAction.ID,
title: { value: label, original: `Preferences: Open Remote Settings (${hostLabel})` },
category: nls.localize('preferencesCategory', "Preferences")
},
when: RemoteAuthorityContext.notEqualsTo('')
});
});
}
private updatePreferencesEditorMenuItem() {
const commandId = '_workbench.openWorkspaceSettingsEditor';
if (this.workpsaceContextService.getWorkbenchState() === WorkbenchState.WORKSPACE && !CommandsRegistry.getCommand(commandId)) {
CommandsRegistry.registerCommand(commandId, () => this.preferencesService.openWorkspaceSettings(false));
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor.svg`)),
dark: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor-inverse.svg`))
}
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource!.toString()), WorkbenchStateContext.isEqualTo('workspace')),
group: 'navigation',
order: 1
});
}
this.updatePreferencesEditorMenuItemForWorkspaceFolders();
}
private updatePreferencesEditorMenuItemForWorkspaceFolders() {
for (const folder of this.workpsaceContextService.getWorkspace().folders) {
const commandId = `_workbench.openFolderSettings.${folder.uri.toString()}`;
if (!CommandsRegistry.getCommand(commandId)) {
CommandsRegistry.registerCommand(commandId, () => {
if (this.workpsaceContextService.getWorkbenchState() === WorkbenchState.FOLDER) {
return this.preferencesService.openWorkspaceSettings(false);
} else {
return this.preferencesService.openFolderSettings(folder.uri, false);
}
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: commandId,
title: OpenSettings2Action.LABEL,
iconLocation: {
light: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor.svg`)),
dark: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/preferences-editor-inverse.svg`))
}
},
when: ContextKeyExpr.and(ResourceContextKey.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(folder.uri)!.toString())),
group: 'navigation',
order: 1
});
}
}
}
}
const workbenchContributionsRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
workbenchContributionsRegistry.registerWorkbenchContribution(PreferencesActionsContribution, LifecyclePhase.Starting);
workbenchContributionsRegistry.registerWorkbenchContribution(PreferencesContribution, LifecyclePhase.Starting);
CommandsRegistry.registerCommand(OPEN_FOLDER_SETTINGS_COMMAND, function (accessor: ServicesAccessor, resource: URI) {
const preferencesService = accessor.get(IPreferencesService);
return preferencesService.openFolderSettings(resource);
});
CommandsRegistry.registerCommand(OpenFolderSettingsAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenFolderSettingsAction, OpenFolderSettingsAction.ID, OpenFolderSettingsAction.LABEL).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: OpenFolderSettingsAction.ID,
title: { value: OpenFolderSettingsAction.LABEL, original: 'Preferences: Open Folder Settings' },
category: nls.localize('preferencesCategory', "Preferences")
},
when: WorkbenchStateContext.isEqualTo('workspace')
});
CommandsRegistry.registerCommand(OpenWorkspaceSettingsAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenWorkspaceSettingsAction, OpenWorkspaceSettingsAction.ID, OpenWorkspaceSettingsAction.LABEL).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: OpenWorkspaceSettingsAction.ID,
title: { value: OpenWorkspaceSettingsAction.LABEL, original: 'Preferences: Open Workspace Settings' },
category: nls.localize('preferencesCategory', "Preferences")
},
when: WorkbenchStateContext.notEqualsTo('empty')
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS),
primary: KeyCode.Escape,
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.clearSearchResults();
}
}
});
CommandsRegistry.registerCommand(OpenGlobalKeybindingsFileAction.ID, serviceAccessor => {
serviceAccessor.get(IInstantiationService).createInstance(OpenGlobalKeybindingsFileAction, OpenGlobalKeybindingsFileAction.ID, OpenGlobalKeybindingsFileAction.LABEL).run();
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: OpenGlobalKeybindingsFileAction.ID,
title: OpenGlobalKeybindingsFileAction.LABEL,
iconLocation: {
light: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/edit-json.svg`)),
dark: URI.parse(require.toUrl(`vs/workbench/contrib/preferences/browser/media/edit-json-inverse.svg`))
}
},
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
group: 'navigation',
});
CommandsRegistry.registerCommand(KEYBINDINGS_EDITOR_SHOW_DEFAULT_KEYBINDINGS, serviceAccessor => {
const control = serviceAccessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.search('@source:default');
}
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: KEYBINDINGS_EDITOR_SHOW_DEFAULT_KEYBINDINGS,
title: nls.localize('showDefaultKeybindings', "Show Default Keybindings")
},
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
group: '1_keyboard_preferences_actions'
});
CommandsRegistry.registerCommand(KEYBINDINGS_EDITOR_SHOW_USER_KEYBINDINGS, serviceAccessor => {
const control = serviceAccessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control) {
control.search('@source:user');
}
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: KEYBINDINGS_EDITOR_SHOW_USER_KEYBINDINGS,
title: nls.localize('showUserKeybindings', "Show User Keybindings")
},
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR),
group: '1_keyboard_preferences_actions'
});
abstract class SettingsCommand extends Command {
protected getPreferencesEditor(accessor: ServicesAccessor): PreferencesEditor | SettingsEditor2 | null {
const activeControl = accessor.get(IEditorService).activeControl;
if (activeControl instanceof PreferencesEditor || activeControl instanceof SettingsEditor2) {
return activeControl;
}
return null;
}
}
class StartSearchDefaultSettingsCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor) {
preferencesEditor.focusSearch();
}
}
}
const startSearchCommand = new StartSearchDefaultSettingsCommand({
id: SETTINGS_EDITOR_COMMAND_SEARCH,
precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR),
kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingWeight.EditorContrib }
});
startSearchCommand.register();
class ClearSearchResultsCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor) {
preferencesEditor.clearSearchResults();
}
}
}
const clearSearchResultsCommand = new ClearSearchResultsCommand({
id: SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS,
precondition: CONTEXT_SETTINGS_SEARCH_FOCUS,
kbOpts: { primary: KeyCode.Escape, weight: KeybindingWeight.EditorContrib }
});
clearSearchResultsCommand.register();
class FocusSettingsFileEditorCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof PreferencesEditor) {
preferencesEditor.focusSettingsFileEditor();
} else if (preferencesEditor) {
preferencesEditor.focusSettings();
}
}
}
const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({
id: SETTINGS_EDITOR_COMMAND_FOCUS_FILE,
precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_SEARCH_FOCUS, SuggestContext.Visible.toNegated()),
kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingWeight.EditorContrib }
});
focusSettingsFileEditorCommand.register();
const focusSettingsFromSearchCommand = new FocusSettingsFileEditorCommand({
id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH,
precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_SEARCH_FOCUS, SuggestContext.Visible.toNegated()),
kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingWeight.WorkbenchContrib }
});
focusSettingsFromSearchCommand.register();
class FocusNextSearchResultCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof PreferencesEditor) {
preferencesEditor.focusNextResult();
}
}
}
const focusNextSearchResultCommand = new FocusNextSearchResultCommand({
id: SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING,
precondition: CONTEXT_SETTINGS_SEARCH_FOCUS,
kbOpts: { primary: KeyCode.Enter, weight: KeybindingWeight.EditorContrib }
});
focusNextSearchResultCommand.register();
class FocusPreviousSearchResultCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof PreferencesEditor) {
preferencesEditor.focusPreviousResult();
}
}
}
const focusPreviousSearchResultCommand = new FocusPreviousSearchResultCommand({
id: SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING,
precondition: CONTEXT_SETTINGS_SEARCH_FOCUS,
kbOpts: { primary: KeyMod.Shift | KeyCode.Enter, weight: KeybindingWeight.EditorContrib }
});
focusPreviousSearchResultCommand.register();
class EditFocusedSettingCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof PreferencesEditor) {
preferencesEditor.editFocusedPreference();
}
}
}
const editFocusedSettingCommand = new EditFocusedSettingCommand({
id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING,
precondition: CONTEXT_SETTINGS_SEARCH_FOCUS,
kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT, weight: KeybindingWeight.EditorContrib }
});
editFocusedSettingCommand.register();
class FocusSettingsListCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof SettingsEditor2) {
preferencesEditor.focusSettings();
}
}
}
const focusSettingsListCommand = new FocusSettingsListCommand({
id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST,
precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS),
kbOpts: { primary: KeyCode.Enter, weight: KeybindingWeight.WorkbenchContrib }
});
focusSettingsListCommand.register();
class ShowContextMenuCommand extends SettingsCommand {
runCommand(accessor: ServicesAccessor, args: any): void {
const preferencesEditor = this.getPreferencesEditor(accessor);
if (preferencesEditor instanceof SettingsEditor2) {
preferencesEditor.showContextMenu();
}
}
}
const showContextMenuCommand = new ShowContextMenuCommand({
id: SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU,
precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR),
kbOpts: { primary: KeyMod.Shift | KeyCode.F9, weight: KeybindingWeight.WorkbenchContrib }
});
showContextMenuCommand.register();
CommandsRegistry.registerCommand(SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON, serviceAccessor => {
const control = serviceAccessor.get(IEditorService).activeControl as SettingsEditor2;
if (control instanceof SettingsEditor2) {
return control.switchToSettingsFile();
}
return Promise.resolve(null);
});
CommandsRegistry.registerCommand(SETTINGS_EDITOR_COMMAND_FILTER_MODIFIED, serviceAccessor => {
const control = serviceAccessor.get(IEditorService).activeControl as SettingsEditor2;
if (control instanceof SettingsEditor2) {
control.focusSearch(`@${MODIFIED_SETTING_TAG}`);
}
});
CommandsRegistry.registerCommand(SETTINGS_EDITOR_COMMAND_FILTER_ONLINE, serviceAccessor => {
const control = serviceAccessor.get(IEditorService).activeControl as SettingsEditor2;
if (control instanceof SettingsEditor2) {
control.focusSearch(`@tag:usesOnlineServices`);
}
});
// Preferences menu
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
group: '1_settings',
command: {
id: SETTINGS_COMMAND_OPEN_SETTINGS,
title: nls.localize({ key: 'miOpenSettings', comment: ['&& denotes a mnemonic'] }, "&&Settings")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
group: '2_keybindings',
command: {
id: OpenGlobalKeybindingsAction.ID,
title: nls.localize({ key: 'miOpenKeymap', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts")
},
order: 1
});
// Editor tool items
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: SETTINGS_EDITOR_COMMAND_SWITCH_TO_JSON,
title: nls.localize('openSettingsJson', "Open Settings (JSON)"),
iconLocation: {
dark: URI.parse(require.toUrl('vs/workbench/contrib/preferences/browser/media/edit-json-inverse.svg')),
light: URI.parse(require.toUrl('vs/workbench/contrib/preferences/browser/media/edit-json.svg'))
}
},
group: 'navigation',
order: 1,
when: ContextKeyExpr.and(
CONTEXT_SETTINGS_EDITOR,
CONTEXT_SETTINGS_JSON_EDITOR.toNegated()
)
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: SETTINGS_EDITOR_COMMAND_FILTER_MODIFIED,
title: nls.localize('filterModifiedLabel', "Show modified settings")
},
group: '1_filter',
order: 1,
when: ContextKeyExpr.and(
CONTEXT_SETTINGS_EDITOR,
CONTEXT_SETTINGS_JSON_EDITOR.toNegated()
)
});
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: SETTINGS_EDITOR_COMMAND_FILTER_ONLINE,
title: nls.localize('filterOnlineServicesLabel', "Show settings for online services"),
},
group: '1_filter',
order: 2,
when: ContextKeyExpr.and(
CONTEXT_SETTINGS_EDITOR,
CONTEXT_SETTINGS_JSON_EDITOR.toNegated()
)
});
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
group: '2_workspace',
order: 20,
command: {
id: OPEN_FOLDER_SETTINGS_COMMAND,
title: OPEN_FOLDER_SETTINGS_LABEL
},
when: ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext)
});

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions';
import { dispose, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { IModelService } from 'vs/editor/common/services/modelService';
@@ -164,7 +164,7 @@ export class OpenWorkspaceSettingsAction extends Action {
static readonly ID = 'workbench.action.openWorkspaceSettings';
static readonly LABEL = nls.localize('openWorkspaceSettings', "Open Workspace Settings");
private readonly disposables = new DisposableStore();
private disposables: IDisposable[] = [];
constructor(
id: string,
@@ -174,7 +174,7 @@ export class OpenWorkspaceSettingsAction extends Action {
) {
super(id, label);
this.update();
this.disposables.add(this.workspaceContextService.onDidChangeWorkbenchState(() => this.update(), this));
this.workspaceContextService.onDidChangeWorkbenchState(() => this.update(), this, this.disposables);
}
private update(): void {
@@ -186,7 +186,7 @@ export class OpenWorkspaceSettingsAction extends Action {
}
dispose(): void {
this.disposables.dispose();
this.disposables = dispose(this.disposables);
super.dispose();
}
}

View File

@@ -31,7 +31,7 @@ import { ConfigurationTarget } from 'vs/platform/configuration/common/configurat
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { ILocalProgressService } from 'vs/platform/progress/common/progress';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -84,7 +84,7 @@ export class PreferencesEditor extends BaseEditor {
readonly minimumHeight = 260;
private _onDidCreateWidget = this._register(new Emitter<{ width: number; height: number; } | undefined>());
private _onDidCreateWidget = new Emitter<{ width: number; height: number; } | undefined>();
readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; } | undefined> = this._onDidCreateWidget.event;
constructor(
@@ -94,7 +94,7 @@ export class PreferencesEditor extends BaseEditor {
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@ILocalProgressService private readonly progressService: ILocalProgressService,
@IProgressService private readonly progressService: IProgressService,
@IStorageService storageService: IStorageService
) {
super(PreferencesEditor.ID, telemetryService, themeService, storageService);
@@ -330,6 +330,11 @@ export class PreferencesEditor extends BaseEditor {
this._lastReportedFilter = filter;
}
}
dispose(): void {
this._onDidCreateWidget.dispose();
super.dispose();
}
}
class SettingsNavigator extends ArrayNavigator<ISetting> {
@@ -769,10 +774,10 @@ class SideBySidePreferencesWidget extends Widget {
private settingsTargetsWidget: SettingsTargetsWidget;
private readonly _onFocus = this._register(new Emitter<void>());
private readonly _onFocus = new Emitter<void>();
readonly onFocus: Event<void> = this._onFocus.event;
private readonly _onDidSettingsTargetChange = this._register(new Emitter<SettingsTarget>());
private readonly _onDidSettingsTargetChange = new Emitter<SettingsTarget>();
readonly onDidSettingsTargetChange: Event<SettingsTarget> = this._onDidSettingsTargetChange.event;
private splitview: SplitView;

View File

@@ -56,13 +56,13 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend
private modelChangeDelayer: Delayer<void> = new Delayer<void>(200);
private associatedPreferencesModel: IPreferencesEditorModel<ISetting>;
private readonly _onFocusPreference = this._register(new Emitter<ISetting>());
private readonly _onFocusPreference = new Emitter<ISetting>();
readonly onFocusPreference: Event<ISetting> = this._onFocusPreference.event;
private readonly _onClearFocusPreference = this._register(new Emitter<ISetting>());
private readonly _onClearFocusPreference = new Emitter<ISetting>();
readonly onClearFocusPreference: Event<ISetting> = this._onClearFocusPreference.event;
private readonly _onUpdatePreference = this._register(new Emitter<{ key: string, value: any, source: IIndexedSetting }>());
private readonly _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
readonly onUpdatePreference: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdatePreference.event;
private filterResult: IFilterResult | undefined;
@@ -233,13 +233,13 @@ export class DefaultSettingsRenderer extends Disposable implements IPreferencesR
private bracesHidingRenderer: BracesHidingRenderer;
private filterResult: IFilterResult | undefined;
private readonly _onUpdatePreference = this._register(new Emitter<{ key: string, value: any, source: IIndexedSetting }>());
private readonly _onUpdatePreference: Emitter<{ key: string, value: any, source: IIndexedSetting }> = new Emitter<{ key: string, value: any, source: IIndexedSetting }>();
readonly onUpdatePreference: Event<{ key: string, value: any, source: IIndexedSetting }> = this._onUpdatePreference.event;
private readonly _onFocusPreference = this._register(new Emitter<ISetting>());
private readonly _onFocusPreference = new Emitter<ISetting>();
readonly onFocusPreference: Event<ISetting> = this._onFocusPreference.event;
private readonly _onClearFocusPreference = this._register(new Emitter<ISetting>());
private readonly _onClearFocusPreference = new Emitter<ISetting>();
readonly onClearFocusPreference: Event<ISetting> = this._onClearFocusPreference.event;
constructor(protected editor: ICodeEditor, readonly preferencesModel: DefaultSettingsEditorModel,
@@ -436,13 +436,13 @@ class DefaultSettingsHeaderRenderer extends Disposable {
export class SettingsGroupTitleRenderer extends Disposable implements HiddenAreasProvider {
private readonly _onHiddenAreasChanged = this._register(new Emitter<void>());
private readonly _onHiddenAreasChanged = new Emitter<void>();
get onHiddenAreasChanged(): Event<void> { return this._onHiddenAreasChanged.event; }
private settingsGroups: ISettingsGroup[];
private hiddenGroups: ISettingsGroup[] = [];
private settingsGroupTitleWidgets: SettingsGroupTitleWidget[];
private renderDisposables: IDisposable[] = [];
private disposables: IDisposable[] = [];
constructor(private editor: ICodeEditor,
@IInstantiationService private readonly instantiationService: IInstantiationService
@@ -474,8 +474,8 @@ export class SettingsGroupTitleRenderer extends Disposable implements HiddenArea
const settingsGroupTitleWidget = this.instantiationService.createInstance(SettingsGroupTitleWidget, this.editor, group);
settingsGroupTitleWidget.render();
this.settingsGroupTitleWidgets.push(settingsGroupTitleWidget);
this.renderDisposables.push(settingsGroupTitleWidget);
this.renderDisposables.push(settingsGroupTitleWidget.onToggled(collapsed => this.onToggled(collapsed, settingsGroupTitleWidget.settingsGroup)));
this.disposables.push(settingsGroupTitleWidget);
this.disposables.push(settingsGroupTitleWidget.onToggled(collapsed => this.onToggled(collapsed, settingsGroupTitleWidget.settingsGroup)));
}
this.settingsGroupTitleWidgets.reverse();
}
@@ -515,7 +515,7 @@ export class SettingsGroupTitleRenderer extends Disposable implements HiddenArea
private disposeWidgets() {
this.hiddenGroups = [];
this.renderDisposables = dispose(this.renderDisposables);
this.disposables = dispose(this.disposables);
}
dispose() {

View File

@@ -1,219 +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 { ISettingsEditorModel, ISetting, ISettingsGroup, ISearchResult, IGroupFilter } from 'vs/workbench/services/preferences/common/preferences';
import { IRange } from 'vs/editor/common/core/range';
import { distinct } from 'vs/base/common/arrays';
import * as strings from 'vs/base/common/strings';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { Registry } from 'vs/platform/registry/common/platform';
import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry';
import { IMatch, or, matchesContiguousSubString, matchesPrefix, matchesCamelCase, matchesWords } from 'vs/base/common/filters';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Disposable } from 'vs/base/common/lifecycle';
import { IPreferencesSearchService, ISearchProvider } from 'vs/workbench/contrib/preferences/common/preferences';
import { CancellationToken } from 'vs/base/common/cancellation';
export interface IEndpointDetails {
urlBase?: string;
key?: string;
}
export class PreferencesSearchService extends Disposable implements IPreferencesSearchService {
_serviceBrand: any;
constructor(
@IInstantiationService protected readonly instantiationService: IInstantiationService,
) {
super();
}
getRemoteSearchProvider(filter: string, newExtensionsOnly = false): ISearchProvider | undefined {
return undefined;
}
getLocalSearchProvider(filter: string): LocalSearchProvider {
return this.instantiationService.createInstance(LocalSearchProvider, filter);
}
}
export class LocalSearchProvider implements ISearchProvider {
static readonly EXACT_MATCH_SCORE = 10000;
static readonly START_SCORE = 1000;
constructor(private _filter: string) {
// Remove " and : which are likely to be copypasted as part of a setting name.
// Leave other special characters which the user might want to search for.
this._filter = this._filter
.replace(/[":]/g, ' ')
.replace(/ /g, ' ')
.trim();
}
searchModel(preferencesModel: ISettingsEditorModel, token?: CancellationToken): Promise<ISearchResult | null> {
if (!this._filter) {
return Promise.resolve(null);
}
let orderedScore = LocalSearchProvider.START_SCORE; // Sort is not stable
const settingMatcher = (setting: ISetting) => {
const matches = new SettingMatches(this._filter, setting, true, true, (filter, setting) => preferencesModel.findValueMatches(filter, setting)).matches;
const score = this._filter === setting.key ?
LocalSearchProvider.EXACT_MATCH_SCORE :
orderedScore--;
return matches && matches.length ?
{
matches,
score
} :
null;
};
const filterMatches = preferencesModel.filterSettings(this._filter, this.getGroupFilter(this._filter), settingMatcher);
if (filterMatches[0] && filterMatches[0].score === LocalSearchProvider.EXACT_MATCH_SCORE) {
return Promise.resolve({
filterMatches: filterMatches.slice(0, 1),
exactMatch: true
});
} else {
return Promise.resolve({
filterMatches
});
}
}
private getGroupFilter(filter: string): IGroupFilter {
const regex = strings.createRegExp(filter, false, { global: true });
return (group: ISettingsGroup) => {
return regex.test(group.title);
};
}
}
export class SettingMatches {
private readonly descriptionMatchingWords: Map<string, IRange[]> = new Map<string, IRange[]>();
private readonly keyMatchingWords: Map<string, IRange[]> = new Map<string, IRange[]>();
private readonly valueMatchingWords: Map<string, IRange[]> = new Map<string, IRange[]>();
readonly matches: IRange[];
constructor(searchString: string, setting: ISetting, private requireFullQueryMatch: boolean, private searchDescription: boolean, private valuesMatcher: (filter: string, setting: ISetting) => IRange[]) {
this.matches = distinct(this._findMatchesInSetting(searchString, setting), (match) => `${match.startLineNumber}_${match.startColumn}_${match.endLineNumber}_${match.endColumn}_`);
}
private _findMatchesInSetting(searchString: string, setting: ISetting): IRange[] {
const result = this._doFindMatchesInSetting(searchString, setting);
if (setting.overrides && setting.overrides.length) {
for (const subSetting of setting.overrides) {
const subSettingMatches = new SettingMatches(searchString, subSetting, this.requireFullQueryMatch, this.searchDescription, this.valuesMatcher);
const words = searchString.split(' ');
const descriptionRanges: IRange[] = this.getRangesForWords(words, this.descriptionMatchingWords, [subSettingMatches.descriptionMatchingWords, subSettingMatches.keyMatchingWords, subSettingMatches.valueMatchingWords]);
const keyRanges: IRange[] = this.getRangesForWords(words, this.keyMatchingWords, [subSettingMatches.descriptionMatchingWords, subSettingMatches.keyMatchingWords, subSettingMatches.valueMatchingWords]);
const subSettingKeyRanges: IRange[] = this.getRangesForWords(words, subSettingMatches.keyMatchingWords, [this.descriptionMatchingWords, this.keyMatchingWords, subSettingMatches.valueMatchingWords]);
const subSettinValueRanges: IRange[] = this.getRangesForWords(words, subSettingMatches.valueMatchingWords, [this.descriptionMatchingWords, this.keyMatchingWords, subSettingMatches.keyMatchingWords]);
result.push(...descriptionRanges, ...keyRanges, ...subSettingKeyRanges, ...subSettinValueRanges);
result.push(...subSettingMatches.matches);
}
}
return result;
}
private _doFindMatchesInSetting(searchString: string, setting: ISetting): IRange[] {
const registry: { [qualifiedKey: string]: IJSONSchema } = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();
const schema: IJSONSchema = registry[setting.key];
const words = searchString.split(' ');
const settingKeyAsWords: string = setting.key.split('.').join(' ');
for (const word of words) {
if (this.searchDescription) {
for (let lineIndex = 0; lineIndex < setting.description.length; lineIndex++) {
const descriptionMatches = matchesWords(word, setting.description[lineIndex], true);
if (descriptionMatches) {
this.descriptionMatchingWords.set(word, descriptionMatches.map(match => this.toDescriptionRange(setting, match, lineIndex)));
}
}
}
const keyMatches = or(matchesWords, matchesCamelCase)(word, settingKeyAsWords);
if (keyMatches) {
this.keyMatchingWords.set(word, keyMatches.map(match => this.toKeyRange(setting, match)));
}
const valueMatches = typeof setting.value === 'string' ? matchesContiguousSubString(word, setting.value) : null;
if (valueMatches) {
this.valueMatchingWords.set(word, valueMatches.map(match => this.toValueRange(setting, match)));
} else if (schema && schema.enum && schema.enum.some(enumValue => typeof enumValue === 'string' && !!matchesContiguousSubString(word, enumValue))) {
this.valueMatchingWords.set(word, []);
}
}
const descriptionRanges: IRange[] = [];
if (this.searchDescription) {
for (let lineIndex = 0; lineIndex < setting.description.length; lineIndex++) {
const matches = or(matchesContiguousSubString)(searchString, setting.description[lineIndex] || '') || [];
descriptionRanges.push(...matches.map(match => this.toDescriptionRange(setting, match, lineIndex)));
}
if (descriptionRanges.length === 0) {
descriptionRanges.push(...this.getRangesForWords(words, this.descriptionMatchingWords, [this.keyMatchingWords, this.valueMatchingWords]));
}
}
const keyMatches = or(matchesPrefix, matchesContiguousSubString)(searchString, setting.key);
const keyRanges: IRange[] = keyMatches ? keyMatches.map(match => this.toKeyRange(setting, match)) : this.getRangesForWords(words, this.keyMatchingWords, [this.descriptionMatchingWords, this.valueMatchingWords]);
let valueRanges: IRange[] = [];
if (setting.value && typeof setting.value === 'string') {
const valueMatches = or(matchesPrefix, matchesContiguousSubString)(searchString, setting.value);
valueRanges = valueMatches ? valueMatches.map(match => this.toValueRange(setting, match)) : this.getRangesForWords(words, this.valueMatchingWords, [this.keyMatchingWords, this.descriptionMatchingWords]);
} else {
valueRanges = this.valuesMatcher ? this.valuesMatcher(searchString, setting) : [];
}
return [...descriptionRanges, ...keyRanges, ...valueRanges];
}
private getRangesForWords(words: string[], from: Map<string, IRange[]>, others: Map<string, IRange[]>[]): IRange[] {
const result: IRange[] = [];
for (const word of words) {
const ranges = from.get(word);
if (ranges) {
result.push(...ranges);
} else if (this.requireFullQueryMatch && others.every(o => !o.has(word))) {
return [];
}
}
return result;
}
private toKeyRange(setting: ISetting, match: IMatch): IRange {
return {
startLineNumber: setting.keyRange.startLineNumber,
startColumn: setting.keyRange.startColumn + match.start,
endLineNumber: setting.keyRange.startLineNumber,
endColumn: setting.keyRange.startColumn + match.end
};
}
private toDescriptionRange(setting: ISetting, match: IMatch, lineIndex: number): IRange {
return {
startLineNumber: setting.descriptionRanges[lineIndex].startLineNumber,
startColumn: setting.descriptionRanges[lineIndex].startColumn + match.start,
endLineNumber: setting.descriptionRanges[lineIndex].endLineNumber,
endColumn: setting.descriptionRanges[lineIndex].startColumn + match.end
};
}
private toValueRange(setting: ISetting, match: IMatch): IRange {
return {
startLineNumber: setting.valueRange.startLineNumber,
startColumn: setting.valueRange.startColumn + match.start + 1,
endLineNumber: setting.valueRange.startLineNumber,
endColumn: setting.valueRange.startColumn + match.end + 1
};
}
}

View File

@@ -484,7 +484,7 @@ export class SettingsTargetsWidget extends Widget {
private _settingsTarget: SettingsTarget;
private readonly _onDidTargetChange = this._register(new Emitter<SettingsTarget>());
private readonly _onDidTargetChange = new Emitter<SettingsTarget>();
readonly onDidTargetChange: Event<SettingsTarget> = this._onDidTargetChange.event;
constructor(
@@ -517,7 +517,7 @@ export class SettingsTargetsWidget extends Widget {
const remoteAuthority = this.environmentService.configuration.remoteAuthority;
const hostLabel = remoteAuthority && this.labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAuthority);
const remoteSettingsLabel = localize('userSettingsRemote', "Remote") +
(hostLabel ? ` [${hostLabel}]` : '');
(hostLabel ? ` (${hostLabel})` : '');
this.userRemoteSettings = new Action('userSettingsRemote', remoteSettingsLabel, '.settings-tab', true, () => this.updateTarget(ConfigurationTarget.USER_REMOTE));
this.userRemoteSettings.tooltip = this.userRemoteSettings.label;
@@ -751,7 +751,7 @@ export class EditPreferenceWidget<T> extends Disposable {
private _editPreferenceDecoration: string[];
private readonly _onClick = this._register(new Emitter<IEditorMouseEvent>());
private readonly _onClick = new Emitter<IEditorMouseEvent>();
get onClick(): Event<IEditorMouseEvent> { return this._onClick.event; }
constructor(private editor: ICodeEditor

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ import { Color, RGBA } from 'vs/base/common/color';
import { onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { dispose, IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { ISpliceable } from 'vs/base/common/sequence';
import { escapeRegExpCharacters, startsWith } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
@@ -45,7 +45,6 @@ import { ISettingsEditorViewState, settingKeyToDisplayFormat, SettingsTreeElemen
import { ExcludeSettingWidget, IExcludeChangeEvent, IExcludeDataItem, settingsHeaderForeground, settingsNumberInputBackground, settingsNumberInputBorder, settingsNumberInputForeground, settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground } from 'vs/workbench/contrib/preferences/browser/settingsWidgets';
import { SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/contrib/preferences/common/preferences';
import { ISetting, ISettingsGroup, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
const $ = DOM.$;
@@ -250,7 +249,7 @@ export interface ISettingOverrideClickEvent {
targetKey: string;
}
export abstract class AbstractSettingRenderer extends Disposable implements ITreeRenderer<SettingsTreeElement, never, any> {
export abstract class AbstractSettingRenderer implements ITreeRenderer<SettingsTreeElement, never, any> {
/** To override */
abstract get templateId(): string;
@@ -262,19 +261,19 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
static readonly SETTING_KEY_ATTR = 'data-key';
static readonly SETTING_ID_ATTR = 'data-id';
private readonly _onDidClickOverrideElement = this._register(new Emitter<ISettingOverrideClickEvent>());
private readonly _onDidClickOverrideElement = new Emitter<ISettingOverrideClickEvent>();
readonly onDidClickOverrideElement: Event<ISettingOverrideClickEvent> = this._onDidClickOverrideElement.event;
protected readonly _onDidChangeSetting = this._register(new Emitter<ISettingChangeEvent>());
protected readonly _onDidChangeSetting = new Emitter<ISettingChangeEvent>();
readonly onDidChangeSetting: Event<ISettingChangeEvent> = this._onDidChangeSetting.event;
protected readonly _onDidOpenSettings = this._register(new Emitter<string>());
protected readonly _onDidOpenSettings = new Emitter<string>();
readonly onDidOpenSettings: Event<string> = this._onDidOpenSettings.event;
private readonly _onDidClickSettingLink = this._register(new Emitter<ISettingLinkClickEvent>());
private readonly _onDidClickSettingLink = new Emitter<ISettingLinkClickEvent>();
readonly onDidClickSettingLink: Event<ISettingLinkClickEvent> = this._onDidClickSettingLink.event;
private readonly _onDidFocusSetting = this._register(new Emitter<SettingsTreeSettingElement>());
private readonly _onDidFocusSetting = new Emitter<SettingsTreeSettingElement>();
readonly onDidFocusSetting: Event<SettingsTreeSettingElement> = this._onDidFocusSetting.event;
// Put common injections back here
@@ -288,7 +287,6 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
@IContextMenuService protected readonly _contextMenuService: IContextMenuService,
@IKeybindingService protected readonly _keybindingService: IKeybindingService,
) {
super();
}
renderTemplate(container: HTMLElement): any {
@@ -941,11 +939,11 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
const deprecationWarningElement = DOM.append(container, $('.setting-item-deprecation-message'));
const toDispose = new DisposableStore();
const toDispose: IDisposable[] = [];
const checkbox = new Checkbox({ actionClassName: 'setting-value-checkbox', isChecked: true, title: '', inputActiveOptionBorder: undefined });
controlElement.appendChild(checkbox.domNode);
toDispose.add(checkbox);
toDispose.add(checkbox.onChange(() => {
toDispose.push(checkbox);
toDispose.push(checkbox.onChange(() => {
if (template.onChange) {
template.onChange(checkbox.checked);
}
@@ -953,7 +951,7 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
// Need to listen for mouse clicks on description and toggle checkbox - use target ID for safety
// Also have to ignore embedded links - too buried to stop propagation
toDispose.add(DOM.addDisposableListener(descriptionElement, DOM.EventType.MOUSE_DOWN, (e) => {
toDispose.push(DOM.addDisposableListener(descriptionElement, DOM.EventType.MOUSE_DOWN, (e) => {
const targetElement = <HTMLElement>e.target;
const targetId = descriptionElement.getAttribute('checkbox_label_target_id');
@@ -970,10 +968,10 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
checkbox.domNode.classList.add(AbstractSettingRenderer.CONTROL_CLASS);
const toolbarContainer = DOM.append(container, $('.setting-toolbar-container'));
const toolbar = this.renderSettingToolbar(toolbarContainer);
toDispose.add(toolbar);
toDispose.push(toolbar);
const template: ISettingBoolItemTemplate = {
toDispose: [toDispose],
toDispose,
containerElement: container,
categoryElement,
@@ -989,16 +987,16 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
this.addSettingElementFocusHandler(template);
// Prevent clicks from being handled by list
toDispose.add(DOM.addDisposableListener(controlElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
toDispose.push(DOM.addDisposableListener(controlElement, 'mousedown', (e: IMouseEvent) => e.stopPropagation()));
toDispose.add(DOM.addStandardDisposableListener(controlElement, 'keydown', (e: StandardKeyboardEvent) => {
toDispose.push(DOM.addStandardDisposableListener(controlElement, 'keydown', (e: StandardKeyboardEvent) => {
if (e.keyCode === KeyCode.Escape) {
e.browserEvent.stopPropagation();
}
}));
toDispose.add(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_ENTER, e => container.classList.add('mouseover')));
toDispose.add(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_LEAVE, e => container.classList.remove('mouseover')));
toDispose.push(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_ENTER, e => container.classList.add('mouseover')));
toDispose.push(DOM.addDisposableListener(titleElement, DOM.EventType.MOUSE_LEAVE, e => container.classList.remove('mouseover')));
return template;
}
@@ -1165,7 +1163,6 @@ function escapeInvisibleChars(enumValue: string): string {
export class SettingsTreeFilter implements ITreeFilter<SettingsTreeElement> {
constructor(
private viewState: ISettingsEditorViewState,
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService,
) { }
filter(element: SettingsTreeElement, parentVisibility: TreeVisibility): TreeFilterResult<void> {
@@ -1178,8 +1175,7 @@ export class SettingsTreeFilter implements ITreeFilter<SettingsTreeElement> {
// Non-user scope selected
if (element instanceof SettingsTreeSettingElement && this.viewState.settingsTarget !== ConfigurationTarget.USER_LOCAL) {
const isRemote = !!this.environmentService.configuration.remoteAuthority;
if (!element.matchesScope(this.viewState.settingsTarget, isRemote)) {
if (!element.matchesScope(this.viewState.settingsTarget)) {
return false;
}
}
@@ -1307,8 +1303,7 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
container: HTMLElement,
viewState: ISettingsEditorViewState,
renderers: ITreeRenderer<any, void, any>[],
@IThemeService themeService: IThemeService,
@IInstantiationService instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService
) {
const treeClass = 'settings-editor-tree';
@@ -1325,7 +1320,7 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
}
},
styleController: new DefaultStyleController(DOM.createStyleSheet(container), treeClass),
filter: instantiationService.createInstance(SettingsTreeFilter, viewState)
filter: new SettingsTreeFilter(viewState)
});
this.disposables = [];

View File

@@ -14,7 +14,6 @@ import { SettingsTarget } from 'vs/workbench/contrib/preferences/browser/prefere
import { ITOCEntry, knownAcronyms, knownTermMappings } from 'vs/workbench/contrib/preferences/browser/settingsLayout';
import { MODIFIED_SETTING_TAG } from 'vs/workbench/contrib/preferences/common/preferences';
import { IExtensionSetting, ISearchResult, ISetting, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export const ONLINE_SERVICES_SETTING_TAG = 'usesOnlineServices';
@@ -222,7 +221,7 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
}
}
matchesScope(scope: SettingsTarget, isRemote: boolean): boolean {
matchesScope(scope: SettingsTarget): boolean {
const configTarget = URI.isUri(scope) ? ConfigurationTarget.WORKSPACE_FOLDER : scope;
if (configTarget === ConfigurationTarget.WORKSPACE_FOLDER) {
@@ -237,10 +236,6 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
return this.setting.scope === ConfigurationScope.MACHINE || this.setting.scope === ConfigurationScope.WINDOW || this.setting.scope === ConfigurationScope.RESOURCE;
}
if (configTarget === ConfigurationTarget.USER_LOCAL && isRemote) {
return this.setting.scope !== ConfigurationScope.MACHINE;
}
return true;
}
@@ -484,8 +479,7 @@ export class SearchResultModel extends SettingsTreeModel {
constructor(
viewState: ISettingsEditorViewState,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService,
@IConfigurationService configurationService: IConfigurationService
) {
super(viewState, configurationService);
this.update({ id: 'searchResultModel', label: '' });
@@ -543,9 +537,8 @@ export class SearchResultModel extends SettingsTreeModel {
});
// Save time, filter children in the search model instead of relying on the tree filter, which still requires heights to be calculated.
const isRemote = !!this.environmentService.configuration.remoteAuthority;
this.root.children = this.root.children
.filter(child => child instanceof SettingsTreeSettingElement && child.matchesAllTags(this._viewState.tagFilters) && child.matchesScope(this._viewState.settingsTarget, isRemote) && child.matchesAnyExtension(this._viewState.extensionFilters));
.filter(child => child instanceof SettingsTreeSettingElement && child.matchesAllTags(this._viewState.tagFilters) && child.matchesScope(this._viewState.settingsTarget) && child.matchesAnyExtension(this._viewState.extensionFilters));
if (this.newExtensionSearchResults && this.newExtensionSearchResults.filterMatches.length) {
const newExtElement = new SettingsTreeNewExtensionsElement();

View File

@@ -203,7 +203,7 @@ export class ExcludeSettingWidget extends Disposable {
private model = new ExcludeSettingListModel();
private readonly _onDidChangeExclude = this._register(new Emitter<IExcludeChangeEvent>());
private readonly _onDidChangeExclude = new Emitter<IExcludeChangeEvent>();
readonly onDidChangeExclude: Event<IExcludeChangeEvent> = this._onDidChangeExclude.event;
get domNode(): HTMLElement {

View File

@@ -17,7 +17,6 @@ import { SettingsTreeFilter } from 'vs/workbench/contrib/preferences/browser/set
import { ISettingsEditorViewState, SearchResultModel, SettingsTreeElement, SettingsTreeGroupElement, SettingsTreeSettingElement } from 'vs/workbench/contrib/preferences/browser/settingsTreeModels';
import { settingsHeaderForeground } from 'vs/workbench/contrib/preferences/browser/settingsWidgets';
import { localize } from 'vs/nls';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
const $ = DOM.$;
@@ -26,10 +25,7 @@ export class TOCTreeModel {
private _currentSearchModel: SearchResultModel | null;
private _settingsTreeRoot: SettingsTreeGroupElement;
constructor(
private _viewState: ISettingsEditorViewState,
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService
) {
constructor(private _viewState: ISettingsEditorViewState) {
}
get settingsTreeRoot(): SettingsTreeGroupElement {
@@ -85,8 +81,7 @@ export class TOCTreeModel {
}
// Check everything that the SettingsFilter checks except whether it's filtered by a category
const isRemote = !!this.environmentService.configuration.remoteAuthority;
return child.matchesScope(this._viewState.settingsTarget, isRemote) && child.matchesAllTags(this._viewState.tagFilters) && child.matchesAnyExtension(this._viewState.extensionFilters);
return child.matchesScope(this._viewState.settingsTarget) && child.matchesAllTags(this._viewState.tagFilters) && child.matchesAnyExtension(this._viewState.extensionFilters);
}).length;
}
}