Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alvsan09 committed Apr 7, 2022
1 parent 917d913 commit 5ba001c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 29 deletions.
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/plugin/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export class CommentsExtImpl implements CommentsExt {

const documentData = this._documents.getDocumentData(URI.revive(uriComponents));
if (documentData) {
const ranges: theia.Range[] | undefined = await commentController.commentingRangeProvider!.provideCommentingRanges(documentData.document, token);
const ranges: theia.Range[] | undefined | null =
await commentController.commentingRangeProvider!.provideCommentingRanges(documentData.document, token);
if (ranges) {
return ranges.map(x => fromRange(x));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/languages/lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class CodeLensAdapter {
return undefined;
}

let newLens: theia.CodeLens | undefined;
let newLens: theia.CodeLens | undefined | null;
if (typeof this.provider.resolveCodeLens === 'function' && !lens.isResolved) {
newLens = await this.provider.resolveCodeLens(lens, token);
if (token.isCancellationRequested) {
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-ext/src/plugin/node/debug/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,6 @@ export class DebugExtImpl implements DebugExt {
return result;
}

/**
* @deprecated since 1.25.0. Use $registerDebugConfigurationProvider with $resolveDebugConfigurationByHandle instead.
*/
async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
let current = debugConfiguration;

Expand All @@ -434,9 +431,6 @@ export class DebugExtImpl implements DebugExt {
return current;
}

/**
* @deprecated since 1.25.0. Use $registerDebugConfigurationProvider with $resolveDebugConfigurationWithSubstitutedVariablesByHandle instead.
*/
async $resolveDebugConfigurationWithSubstitutedVariables(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined):
Promise<theia.DebugConfiguration | undefined> {
let current = debugConfiguration;
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/plugin/tree/tree-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ class TreeViewExtImpl<T> implements Disposable {
// root
return [];
}
const parent = this.treeDataProvider.getParent && await this.treeDataProvider.getParent(element);
const result = this.treeDataProvider.getParent && await this.treeDataProvider.getParent(element);
const parent = result ? result : undefined;
const chain = await this.calculateRevealParentChain(parent);
if (!chain) {
// parents are inconsistent
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-ext/src/plugin/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ export class WorkspaceExtImpl implements WorkspaceExt {
async $provideTextDocumentContent(documentURI: string): Promise<string | undefined> {
const uri = URI.parse(documentURI);
const provider = this.documentContentProviders.get(uri.scheme);
if (provider) {
return provider.provideTextDocumentContent(uri, CancellationToken.None);
if (!provider) {
return undefined;
}

return undefined;
const response = await provider.provideTextDocumentContent(uri, CancellationToken.None);
return response ? response : undefined;
}

getWorkspaceFolder(uri: theia.Uri, resolveParent?: boolean): theia.WorkspaceFolder | undefined {
Expand Down
20 changes: 4 additions & 16 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6844,8 +6844,7 @@ export module '@theia/plugin' {
* thenable.
*
*/
export type ProviderResult<T> = T | undefined | PromiseLike<T | undefined>;

export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
/**
* A symbol kind.
*/
Expand Down Expand Up @@ -9662,10 +9661,7 @@ export module '@theia/plugin' {
* @param token A cancellation token.
* @return An array of {@link DebugConfiguration debug configurations}.
*/
provideDebugConfigurations?(
folder: WorkspaceFolder | undefined,
token?: CancellationToken
): ProviderResult<DebugConfiguration[]>;
provideDebugConfigurations?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugConfiguration[]>;

/**
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values or by adding/changing/removing attributes.
Expand All @@ -9679,11 +9675,7 @@ export module '@theia/plugin' {
* @param token A cancellation token.
* @return The resolved debug configuration or undefined or null.
*/
resolveDebugConfiguration?(
folder: WorkspaceFolder | undefined,
debugConfiguration: DebugConfiguration,
token?: CancellationToken
): ProviderResult<DebugConfiguration | undefined | null>;
resolveDebugConfiguration?(folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, token?: CancellationToken): ProviderResult<DebugConfiguration>;

/**
* This hook is directly called after 'resolveDebugConfiguration' but with all variables substituted.
Expand All @@ -9698,11 +9690,7 @@ export module '@theia/plugin' {
* @param token A cancellation token.
* @return The resolved debug configuration or undefined or null.
*/
resolveDebugConfigurationWithSubstitutedVariables?(
folder: WorkspaceFolder | undefined,
debugConfiguration: DebugConfiguration,
token?: CancellationToken
): ProviderResult<DebugConfiguration | undefined | null>;
resolveDebugConfigurationWithSubstitutedVariables?(folder: WorkspaceFolder | undefined, debugConfiguration: DebugConfiguration, token?: CancellationToken): ProviderResult<DebugConfiguration>;
}

/**
Expand Down

0 comments on commit 5ba001c

Please sign in to comment.