Merge from vscode 8a997f7321ae6612fc0e6eb3eac4f358a6233bfb

This commit is contained in:
ADS Merger
2020-02-11 07:08:19 +00:00
parent 0f934081e1
commit 085752f111
217 changed files with 2561 additions and 2063 deletions

View File

@@ -611,7 +611,14 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
return;
} else {
const scrollAdjustment = this._getHeight();
let scrollAdjustment = this._getHeight();
// if the editor has top padding, factor that into the zone height
scrollAdjustment -= this._codeEditor.getOption(EditorOption.padding).top;
if (scrollAdjustment <= 0) {
return;
}
viewZone.heightInPx = scrollAdjustment;
this._viewZoneId = accessor.addZone(viewZone);

View File

@@ -304,7 +304,7 @@ export class MarkerController implements IEditorContribution {
model.currentMarker = marker;
}
private _onMarkerChanged(changedResources: URI[]): void {
private _onMarkerChanged(changedResources: readonly URI[]): void {
const editorModel = this._editor.getModel();
if (!editorModel) {
return;

View File

@@ -134,10 +134,10 @@ class MessageWidget {
detailsElement.appendChild(codeElement);
} else {
this._codeLink = dom.$('a.code-link');
this._codeLink.setAttribute('href', `${code.link.toString()}`);
this._codeLink.setAttribute('href', `${code.target.toString()}`);
this._codeLink.onclick = (e) => {
this._openerService.open(code.link);
this._openerService.open(code.target);
e.preventDefault();
e.stopPropagation();
};

View File

@@ -516,10 +516,10 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
sourceElement.innerText = source;
}
this._codeLink = dom.append(sourceAndCodeElement, $('a.code-link'));
this._codeLink.setAttribute('href', code.link.toString());
this._codeLink.setAttribute('href', code.target.toString());
this._codeLink.onclick = (e) => {
this._openerService.open(code.link);
this._openerService.open(code.target);
e.preventDefault();
e.stopPropagation();
};

View File

@@ -468,6 +468,7 @@ export class SnippetSession {
// that ensures the primiary cursor stays primary despite not being
// the one with lowest start position
edits[idx] = EditOperation.replace(snippetSelection, snippet.toString());
edits[idx].identifier = { major: idx, minor: 0 }; // mark the edit so only our undo edits will be used to generate end cursors
snippets[idx] = new OneSnippet(editor, snippet, offset);
}
@@ -507,7 +508,11 @@ export class SnippetSession {
if (this._snippets[0].hasPlaceholder) {
return this._move(true);
} else {
return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition()));
return (
undoEdits
.filter(edit => !!edit.identifier) // only use our undo edits
.map(edit => Selection.fromPositions(edit.range.getEndPosition()))
);
}
});
this._editor.revealRange(this._editor.getSelections()[0]);
@@ -529,7 +534,11 @@ export class SnippetSession {
if (this._snippets[0].hasPlaceholder) {
return this._move(undefined);
} else {
return undoEdits.map(edit => Selection.fromPositions(edit.range.getEndPosition()));
return (
undoEdits
.filter(edit => !!edit.identifier) // only use our undo edits
.map(edit => Selection.fromPositions(edit.range.getEndPosition()))
);
}
});
}

View File

@@ -11,6 +11,7 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { NullLogService } from 'vs/platform/log/common/log';
import { Handler } from 'vs/editor/common/editorCommon';
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
suite('SnippetController2', function () {
@@ -428,4 +429,13 @@ suite('SnippetController2', function () {
assertSelections(editor, new Selection(2, 5, 2, 5));
assertContextKeys(contextKeys, false, false, false);
});
test('issue #90135: confusing trim whitespace edits', function () {
const ctrl = new SnippetController2(editor, logService, contextKeys);
model.setValue('');
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
ctrl.insert('\nfoo');
assertSelections(editor, new Selection(2, 8, 2, 8));
});
});