mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d
This commit is contained in:
committed by
AzureDataStudio
parent
a8a7559229
commit
1388493cc1
@@ -5,6 +5,7 @@
|
||||
|
||||
import { IRelativePattern, match as matchGlobPattern } from 'vs/base/common/glob';
|
||||
import { URI } from 'vs/base/common/uri'; // TODO@Alex
|
||||
import { normalize } from 'vs/base/common/path';
|
||||
|
||||
export interface LanguageFilter {
|
||||
language?: string;
|
||||
@@ -83,7 +84,19 @@ export function score(selector: LanguageSelector | undefined, candidateUri: URI,
|
||||
}
|
||||
|
||||
if (pattern) {
|
||||
if (pattern === candidateUri.fsPath || matchGlobPattern(pattern, candidateUri.fsPath)) {
|
||||
let normalizedPattern: string | IRelativePattern;
|
||||
if (typeof pattern === 'string') {
|
||||
normalizedPattern = pattern;
|
||||
} else {
|
||||
// Since this pattern has a `base` property, we need
|
||||
// to normalize this path first before passing it on
|
||||
// because we will compare it against `Uri.fsPath`
|
||||
// which uses platform specific separators.
|
||||
// Refs: https://github.com/microsoft/vscode/issues/99938
|
||||
normalizedPattern = { ...pattern, base: normalize(pattern.base) };
|
||||
}
|
||||
|
||||
if (normalizedPattern === candidateUri.fsPath || matchGlobPattern(normalizedPattern, candidateUri.fsPath)) {
|
||||
ret = 10;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -154,7 +154,7 @@ function getClassifier(): CharacterClassifier<CharacterClass> {
|
||||
if (_classifier === null) {
|
||||
_classifier = new CharacterClassifier<CharacterClass>(CharacterClass.None);
|
||||
|
||||
const FORCE_TERMINATION_CHARACTERS = ' \t<>\'\"、。。、,.:;?!@#$%&*‘“〈《「『【〔([{「」}])〕】』」》〉”’`~…';
|
||||
const FORCE_TERMINATION_CHARACTERS = ' \t<>\'\"、。。、,.:;‘“〈《「『【〔([{「」}])〕】』」》〉”’`~…';
|
||||
for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {
|
||||
_classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), CharacterClass.ForceTermination);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user