Introduce GlobPattern and adopt in DocumentFilter/FileWatcher/FileSearch (#34695)

* introduce IRelativePattern and use in extension API

* 💄

* docs

* introduce RelativePattern

* support RelativePattern also for file watcher

* also make findFiles support RelativePattern

* less type conversion

* add GlobPattern type and remove readonly

* make base a string

* fix setter access to RelativePattern

* fix npe when exclude is undefined

* fix findFiles: pattern seems to be matched against workspace always

* 💄

* clarify glob pattern matching
This commit is contained in:
Benjamin Pasero
2017-09-22 13:52:23 +02:00
committed by GitHub
parent 9e05d4b635
commit 3e9fa59616
11 changed files with 169 additions and 38 deletions

View File

@@ -6,7 +6,7 @@
import Event, { Emitter } from 'vs/base/common/event';
import { Disposable } from './extHostTypes';
import { parse } from 'vs/base/common/glob';
import { parse, IRelativePattern } from 'vs/base/common/glob';
import { Uri, FileSystemWatcher as _FileSystemWatcher } from 'vscode';
import { FileSystemEvents, ExtHostFileSystemEventServiceShape } from './extHost.protocol';
@@ -30,7 +30,7 @@ class FileSystemWatcher implements _FileSystemWatcher {
return Boolean(this._config & 0b100);
}
constructor(dispatcher: Event<FileSystemEvents>, globPattern: string, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean) {
constructor(dispatcher: Event<FileSystemEvents>, globPattern: string | IRelativePattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean) {
this._config = 0;
if (ignoreCreateEvents) {
@@ -96,7 +96,7 @@ export class ExtHostFileSystemEventService implements ExtHostFileSystemEventServ
constructor() {
}
public createFileSystemWatcher(globPattern: string, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): _FileSystemWatcher {
public createFileSystemWatcher(globPattern: string | IRelativePattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): _FileSystemWatcher {
return new FileSystemWatcher(this._emitter.event, globPattern, ignoreCreateEvents, ignoreChangeEvents, ignoreDeleteEvents);
}