Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show progress indicator for implementation cmd #32838

Merged
merged 2 commits into from
Aug 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { MessageController } from './messageController';
import * as corePosition from 'vs/editor/common/core/position';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { IProgressService } from 'vs/platform/progress/common/progress';

export class DefinitionActionConfig {

Expand All @@ -50,11 +51,12 @@ export class DefinitionAction extends EditorAction {
public run(accessor: ServicesAccessor, editor: editorCommon.ICommonCodeEditor): TPromise<void> {
const messageService = accessor.get(IMessageService);
const editorService = accessor.get(IEditorService);
const progressService = accessor.get(IProgressService);

const model = editor.getModel();
const pos = editor.getPosition();

return this._getDeclarationsAtPosition(model, pos).then(references => {
const definitionPromise = this._getDeclarationsAtPosition(model, pos).then(references => {

if (model.isDisposed() || editor.getModel() !== model) {
// new model, no more model
Expand Down Expand Up @@ -104,6 +106,9 @@ export class DefinitionAction extends EditorAction {
// report an error
messageService.show(Severity.Error, err);
});

progressService.showWhile(definitionPromise, 250);
return definitionPromise;
}

protected _getDeclarationsAtPosition(model: editorCommon.IModel, position: corePosition.Position): TPromise<Location[]> {
Expand Down