diff options
author | Benjamin Pasero <benjpas@microsoft.com> | 2017-11-16 19:23:51 +0300 |
---|---|---|
committer | Benjamin Pasero <benjpas@microsoft.com> | 2017-11-16 19:23:51 +0300 |
commit | b6db56277d80e1453462313b3a161a420ee6cb65 (patch) | |
tree | a96256c528188d77286784b4268828139c2f85d4 /src | |
parent | 05d1ec3ce22472ce9a1ba35d7a1223bd35edfb53 (diff) |
more cleanup (for #38414)
Diffstat (limited to 'src')
-rw-r--r-- | src/vs/base/browser/ui/iconLabel/iconLabel.ts | 5 | ||||
-rw-r--r-- | src/vs/base/common/filters.ts | 11 | ||||
-rw-r--r-- | src/vs/base/common/glob.ts | 5 | ||||
-rw-r--r-- | src/vs/base/common/labels.ts | 8 | ||||
-rw-r--r-- | src/vs/base/common/map.ts | 4 | ||||
-rw-r--r-- | src/vs/base/test/common/filters.perf.test.ts | 2 | ||||
-rw-r--r-- | src/vs/base/test/common/filters.test.ts | 10 | ||||
-rw-r--r-- | src/vs/base/test/node/glob.test.ts | 19 | ||||
-rw-r--r-- | src/vs/platform/workspaces/common/workspaces.ts | 1 | ||||
-rw-r--r-- | src/vs/platform/workspaces/electron-main/workspacesMainService.ts | 8 | ||||
-rw-r--r-- | src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts | 26 |
11 files changed, 2 insertions, 97 deletions
diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index 60dec0ac2a3..945dbd9c26b 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -18,11 +18,6 @@ export interface IIconLabelCreationOptions { supportHighlights?: boolean; } -export interface ILabelBadgeOptions { - title: string; - className: string; -} - export interface IIconLabelOptions { title?: string; extraClasses?: string[]; diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index f4b24888b62..d9fe889ca1d 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -703,13 +703,4 @@ export function nextTypoPermutation(pattern: string, patternPos: number) { + pattern[patternPos + 1] + pattern[patternPos] + pattern.slice(patternPos + 2); -} - -export function fuzzyScoreGraceful(pattern: string, word: string): [number, number[]] { - let ret = fuzzyScore(pattern, word); - for (let patternPos = 1; patternPos < pattern.length - 1 && !ret; patternPos++) { - let pattern2 = nextTypoPermutation(pattern, patternPos); - ret = fuzzyScore(pattern2, word); - } - return ret; -} +}
\ No newline at end of file diff --git a/src/vs/base/common/glob.ts b/src/vs/base/common/glob.ts index 7e11d8c18c0..d051daf96bc 100644 --- a/src/vs/base/common/glob.ts +++ b/src/vs/base/common/glob.ts @@ -5,7 +5,6 @@ 'use strict'; import arrays = require('vs/base/common/arrays'); -import objects = require('vs/base/common/objects'); import strings = require('vs/base/common/strings'); import paths = require('vs/base/common/paths'); import { BoundedMap } from 'vs/base/common/map'; @@ -25,10 +24,6 @@ export function getEmptyExpression(): IExpression { return Object.create(null); } -export function mergeExpressions(...expressions: IExpression[]): IExpression { - return objects.assign(getEmptyExpression(), ...expressions.filter(expr => !!expr)); -} - export interface SiblingClause { when: string; } diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts index a0316776036..a5ec95f8337 100644 --- a/src/vs/base/common/labels.ts +++ b/src/vs/base/common/labels.ts @@ -9,14 +9,6 @@ import platform = require('vs/base/common/platform'); import { nativeSep, normalize, isEqualOrParent, isEqual, basename, join } from 'vs/base/common/paths'; import { endsWith, ltrim } from 'vs/base/common/strings'; -export interface ILabelProvider { - - /** - * Given an element returns a label for it to display in the UI. - */ - getLabel(element: any): string; -} - export interface IWorkspaceFolderProvider { getWorkspaceFolder(resource: URI): { uri: URI }; getWorkspace(): { diff --git a/src/vs/base/common/map.ts b/src/vs/base/common/map.ts index c6a776e9d58..cfbbfd63588 100644 --- a/src/vs/base/common/map.ts +++ b/src/vs/base/common/map.ts @@ -7,10 +7,6 @@ import URI from 'vs/base/common/uri'; -export interface Key { - toString(): string; -} - export interface Entry<K, T> { key: K; value: T; diff --git a/src/vs/base/test/common/filters.perf.test.ts b/src/vs/base/test/common/filters.perf.test.ts index 652fbe65506..82df853e427 100644 --- a/src/vs/base/test/common/filters.perf.test.ts +++ b/src/vs/base/test/common/filters.perf.test.ts @@ -39,7 +39,5 @@ perfSuite('Performance - fuzzyMatch', function () { perfTest('matchesFuzzy', filters.matchesFuzzy); perfTest('fuzzyContiguousFilter', filters.fuzzyContiguousFilter); perfTest('fuzzyScore', filters.fuzzyScore); - perfTest('fuzzyScoreGraceful', filters.fuzzyScoreGraceful); - }); diff --git a/src/vs/base/test/common/filters.test.ts b/src/vs/base/test/common/filters.test.ts index 45018c5a8e4..6aea42f4915 100644 --- a/src/vs/base/test/common/filters.test.ts +++ b/src/vs/base/test/common/filters.test.ts @@ -5,7 +5,7 @@ 'use strict'; import * as assert from 'assert'; -import { IFilter, or, matchesPrefix, matchesStrictPrefix, matchesCamelCase, matchesSubString, matchesContiguousSubString, matchesWords, fuzzyScore, nextTypoPermutation, fuzzyScoreGraceful, IMatch } from 'vs/base/common/filters'; +import { IFilter, or, matchesPrefix, matchesStrictPrefix, matchesCamelCase, matchesSubString, matchesContiguousSubString, matchesWords, fuzzyScore, nextTypoPermutation, IMatch } from 'vs/base/common/filters'; function filterOk(filter: IFilter, word: string, wordToMatchAgainst: string, highlights?: { start: number; end: number; }[]) { let r = filter(word, wordToMatchAgainst); @@ -438,12 +438,4 @@ suite('Filters', () => { assertTypos('abc', 'acb'); assertTypos('foboar', 'fbooar', 'foobar', 'fobaor', 'fobora'); }); - - test('fuzzyScoreGraceful', function () { - - assertMatches('tkb', 'the_black_knight', '^the_^black_^knight', fuzzyScoreGraceful); - assertMatches('tkbk', 'the_black_knight', '^the_^blac^k_^knight', fuzzyScoreGraceful); - assertMatches('tkkb', 'the_black_knight', undefined, fuzzyScoreGraceful); - assertMatches('tkb', 'no_match', undefined, fuzzyScoreGraceful); - }); }); diff --git a/src/vs/base/test/node/glob.test.ts b/src/vs/base/test/node/glob.test.ts index de91bfb6ab5..5df80a2c76c 100644 --- a/src/vs/base/test/node/glob.test.ts +++ b/src/vs/base/test/node/glob.test.ts @@ -907,25 +907,6 @@ suite('Glob', () => { return slashPath.replace(/\//g, path.sep); } - test('mergeExpressions', () => { - // Empty => empty - assert.deepEqual(glob.mergeExpressions(), glob.getEmptyExpression()); - - // Doesn't modify given expressions - const expr1 = { 'a': true }; - glob.mergeExpressions(expr1, { 'b': true }); - assert.deepEqual(expr1, { 'a': true }); - - // Merges correctly - assert.deepEqual(glob.mergeExpressions({ 'a': true }, { 'b': true }), { 'a': true, 'b': true }); - - // Ignores null/undefined portions - assert.deepEqual(glob.mergeExpressions(undefined, { 'a': true }, null, { 'b': true }), { 'a': true, 'b': true }); - - // Later expressions take precedence - assert.deepEqual(glob.mergeExpressions({ 'a': true, 'b': false, 'c': true }, { 'a': false, 'b': true }), { 'a': false, 'b': true, 'c': true }); - }); - test('relative pattern - glob star', function () { if (isWindows) { let p = { base: 'C:\\DNXConsoleApp\\foo', pattern: '**/*.cs' }; diff --git a/src/vs/platform/workspaces/common/workspaces.ts b/src/vs/platform/workspaces/common/workspaces.ts index 8e4e14b1fb9..99c89ede8f1 100644 --- a/src/vs/platform/workspaces/common/workspaces.ts +++ b/src/vs/platform/workspaces/common/workspaces.ts @@ -92,7 +92,6 @@ export interface IWorkspacesMainService extends IWorkspacesService { createWorkspaceSync(folders?: IWorkspaceFolderCreationData[]): IWorkspaceIdentifier; - resolveWorkspace(path: string): TPromise<IResolvedWorkspace>; resolveWorkspaceSync(path: string): IResolvedWorkspace; isUntitledWorkspace(workspace: IWorkspaceIdentifier): boolean; diff --git a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts index d6941cfdbb9..1c59a4d0412 100644 --- a/src/vs/platform/workspaces/electron-main/workspacesMainService.ts +++ b/src/vs/platform/workspaces/electron-main/workspacesMainService.ts @@ -57,14 +57,6 @@ export class WorkspacesMainService implements IWorkspacesMainService { return this._onUntitledWorkspaceDeleted.event; } - public resolveWorkspace(path: string): TPromise<IResolvedWorkspace> { - if (!this.isWorkspacePath(path)) { - return TPromise.as(null); // does not look like a valid workspace config file - } - - return readFile(path).then(contents => this.doResolveWorkspace(path, contents.toString())); - } - public resolveWorkspaceSync(path: string): IResolvedWorkspace { if (!this.isWorkspacePath(path)) { return null; // does not look like a valid workspace config file diff --git a/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts b/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts index 33f0f4e86c5..f112ef8f9eb 100644 --- a/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts +++ b/src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts @@ -186,32 +186,6 @@ suite('WorkspacesMainService', () => { }); }); - test('resolveWorkspace', done => { - return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => { - return service.resolveWorkspace(workspace.configPath).then(ws => { - assert.ok(ws); - - // make it a valid workspace path - const newPath = path.join(path.dirname(workspace.configPath), `workspace.${WORKSPACE_EXTENSION}`); - fs.renameSync(workspace.configPath, newPath); - workspace.configPath = newPath; - - return service.resolveWorkspace(workspace.configPath).then(resolved => { - assert.equal(2, resolved.folders.length); - assert.equal(resolved.configPath, workspace.configPath); - assert.ok(resolved.id); - - fs.writeFileSync(workspace.configPath, JSON.stringify({ something: 'something' })); // invalid workspace - return service.resolveWorkspace(workspace.configPath).then(resolvedInvalid => { - assert.ok(!resolvedInvalid); - - done(); - }); - }); - }); - }); - }); - test('resolveWorkspaceSync (support relative paths)', done => { return createWorkspace([process.cwd(), os.tmpdir()]).then(workspace => { fs.writeFileSync(workspace.configPath, JSON.stringify({ folders: [{ path: './ticino-playground/lib' }] })); |