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

Fixes #47367: Added a go to next error that stays within current file #49391

Merged
merged 1 commit into from
May 8, 2018
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
45 changes: 36 additions & 9 deletions src/vs/editor/contrib/gotoError/gotoError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,12 @@ class MarkerNavigationAction extends EditorAction {

private _isNext: boolean;

constructor(next: boolean, opts: IActionOptions) {
private _multiFile: boolean;

constructor(next: boolean, multiFile: boolean, opts: IActionOptions) {
super(opts);
this._isNext = next;
this._multiFile = multiFile;
}

public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise<void> {
Expand All @@ -309,8 +312,8 @@ class MarkerNavigationAction extends EditorAction {
}

const model = controller.getOrCreateModel();
const atEdge = model.move(this._isNext, false);
if (!atEdge) {
const atEdge = model.move(this._isNext, !this._multiFile);
if (!atEdge || !this._multiFile) {
return undefined;
}

Expand Down Expand Up @@ -369,10 +372,32 @@ class MarkerNavigationAction extends EditorAction {

class NextMarkerAction extends MarkerNavigationAction {
constructor() {
super(true, {
super(true, false, {
id: 'editor.action.marker.next',
label: nls.localize('markerAction.next.label', "Go to Next Problem (Error, Warning, Info)"),
alias: 'Go to Next Error or Warning',
precondition: EditorContextKeys.writable
});
}
}

class PrevMarkerAction extends MarkerNavigationAction {
constructor() {
super(false, false, {
id: 'editor.action.marker.prev',
label: nls.localize('markerAction.previous.label', "Go to Previous Problem (Error, Warning, Info)"),
alias: 'Go to Previous Error or Warning',
precondition: EditorContextKeys.writable
});
}
}

class NextMarkerInFilesAction extends MarkerNavigationAction {
constructor() {
super(true, true, {
id: 'editor.action.marker.nextInFiles',
label: nls.localize('markerAction.nextInFiles.label', "Go to Next Problem in Files (Error, Warning, Info)"),
alias: 'Go to Next Error or Warning in Files',
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.focus,
Expand All @@ -382,12 +407,12 @@ class NextMarkerAction extends MarkerNavigationAction {
}
}

class PrevMarkerAction extends MarkerNavigationAction {
class PrevMarkerInFilesAction extends MarkerNavigationAction {
constructor() {
super(false, {
id: 'editor.action.marker.prev',
label: nls.localize('markerAction.previous.label', "Go to Previous Problem (Error, Warning, Info)"),
alias: 'Go to Previous Error or Warning',
super(false, true, {
id: 'editor.action.marker.prevInFiles',
label: nls.localize('markerAction.previousInFiles.label', "Go to Previous Problem in Files (Error, Warning, Info)"),
alias: 'Go to Previous Error or Warning in Files',
precondition: EditorContextKeys.writable,
kbOpts: {
kbExpr: EditorContextKeys.focus,
Expand All @@ -400,6 +425,8 @@ class PrevMarkerAction extends MarkerNavigationAction {
registerEditorContribution(MarkerController);
registerEditorAction(NextMarkerAction);
registerEditorAction(PrevMarkerAction);
registerEditorAction(NextMarkerInFilesAction);
registerEditorAction(PrevMarkerInFilesAction);

const CONTEXT_MARKERS_NAVIGATION_VISIBLE = new RawContextKey<boolean>('markersNavigationVisible', false);

Expand Down