Skip to content

Commit

Permalink
Fixing some strict null errors in mainThread
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Feb 5, 2019
1 parent ffe09d3 commit 197a916
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export class MainThreadCommands implements MainThreadClipboardShape {

$writeText(value: string): Promise<void> {
clipboard.writeText(value);
return undefined;
return Promise.resolve();
}
}
7 changes: 4 additions & 3 deletions src/vs/workbench/api/electron-browser/mainThreadCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}

$unregisterCommand(id: string): void {
if (this._disposables.has(id)) {
this._disposables.get(id).dispose();
const command = this._disposables.get(id);
if (command) {
command.dispose();
this._disposables.delete(id);
}
}

$executeCommand<T>(id: string, args: any[]): Promise<T> {
$executeCommand<T>(id: string, args: any[]): Promise<T | undefined> {
for (let i = 0; i < args.length; i++) {
args[i] = revive(args[i], 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
}

$onFileSystemChange(handle: number, changes: IFileChangeDto[]): void {
this._fileProvider.get(handle).$onFileSystemChange(changes);
const fileProvider = this._fileProvider.get(handle);
if (!fileProvider) {
throw new Error('Unknown file provider');
}
fileProvider.$onFileSystemChange(changes);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class MainThreadFileSystemEventService {
// file operation events - (changes the editor makes)
fileService.onAfterOperation(e => {
if (e.operation === FileOperation.MOVE) {
proxy.$onFileRename(e.resource, e.target.resource);
proxy.$onFileRename(e.resource, e.target.resource!);
}
}, undefined, this._listener);

Expand Down

0 comments on commit 197a916

Please sign in to comment.