提交 b6db5627 编写于 作者: B Benjamin Pasero

more cleanup (for #38414)

上级 05d1ec3c
......@@ -18,11 +18,6 @@ export interface IIconLabelCreationOptions {
supportHighlights?: boolean;
}
export interface ILabelBadgeOptions {
title: string;
className: string;
}
export interface IIconLabelOptions {
title?: string;
extraClasses?: string[];
......
......@@ -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
......@@ -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;
}
......
......@@ -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(): {
......
......@@ -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;
......
......@@ -39,7 +39,5 @@ perfSuite('Performance - fuzzyMatch', function () {
perfTest('matchesFuzzy', filters.matchesFuzzy);
perfTest('fuzzyContiguousFilter', filters.fuzzyContiguousFilter);
perfTest('fuzzyScore', filters.fuzzyScore);
perfTest('fuzzyScoreGraceful', filters.fuzzyScoreGraceful);
});
......@@ -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);
});
});
......@@ -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' };
......
......@@ -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;
......
......@@ -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
......
......@@ -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' }] }));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册