mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
eng - some extHost strict-null work
This commit is contained in:
@@ -527,7 +527,7 @@ export function createApiFactory(
|
||||
onDidChangeWorkspaceFolders: function (listener, thisArgs?, disposables?) {
|
||||
return extHostWorkspace.onDidChangeWorkspace(listener, thisArgs, disposables);
|
||||
},
|
||||
asRelativePath: (pathOrUri, includeWorkspace) => {
|
||||
asRelativePath: (pathOrUri, includeWorkspace?) => {
|
||||
return extHostWorkspace.getRelativePath(pathOrUri, includeWorkspace);
|
||||
},
|
||||
findFiles: (include, exclude, maxResults?, token?) => {
|
||||
|
||||
@@ -224,7 +224,7 @@ export interface ITextDocumentShowOptions {
|
||||
}
|
||||
|
||||
export interface MainThreadTextEditorsShape extends IDisposable {
|
||||
$tryShowTextDocument(resource: UriComponents, options: ITextDocumentShowOptions): Promise<string>;
|
||||
$tryShowTextDocument(resource: UriComponents, options: ITextDocumentShowOptions): Promise<string | undefined>;
|
||||
$registerTextEditorDecorationType(key: string, options: editorCommon.IDecorationRenderOptions): void;
|
||||
$removeTextEditorDecorationType(key: string): void;
|
||||
$tryShowEditor(id: string, position: EditorViewColumn): Promise<void>;
|
||||
|
||||
@@ -75,7 +75,7 @@ export class ExtHostEditors implements ExtHostEditorsShape {
|
||||
}
|
||||
|
||||
return this._proxy.$tryShowTextDocument(document.uri, options).then(id => {
|
||||
const editor = this._extHostDocumentsAndEditors.getEditor(id);
|
||||
const editor = id && this._extHostDocumentsAndEditors.getEditor(id);
|
||||
if (editor) {
|
||||
return editor;
|
||||
} else {
|
||||
|
||||
@@ -321,10 +321,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||
return folders[0].uri.fsPath;
|
||||
}
|
||||
|
||||
getRelativePath(pathOrUri: string | vscode.Uri, includeWorkspace?: boolean): string | undefined {
|
||||
getRelativePath(pathOrUri: string | vscode.Uri, includeWorkspace?: boolean): string {
|
||||
|
||||
let resource: URI | undefined;
|
||||
let path: string | undefined;
|
||||
let path: string = '';
|
||||
if (typeof pathOrUri === 'string') {
|
||||
resource = URI.file(pathOrUri);
|
||||
path = pathOrUri;
|
||||
@@ -354,7 +354,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
|
||||
if (includeWorkspace && folder.name) {
|
||||
result = `${folder.name}/${result}`;
|
||||
}
|
||||
return result;
|
||||
return result!;
|
||||
}
|
||||
|
||||
private trySetWorkspaceFolders(folders: vscode.WorkspaceFolder[]): void {
|
||||
|
||||
Reference in New Issue
Block a user