Skip to content

Commit

Permalink
Merge remote-tracking branch 'vscode-lean/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed May 10, 2021
2 parents faa196b + 29a03a8 commit ee7f592
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions old/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Server extends leanclient.Server {
switch (e.error) {
case 'stderr':
stderrOutput.append(e.chunk);
stderrOutput.show();
stderrOutput.show(true);
break;
case 'connect':
// json parsing errors
Expand Down Expand Up @@ -180,7 +180,7 @@ export class Server extends leanclient.Server {
// Now show the terminal and run elan.
terminal.show();
terminal.sendText(
'curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh && ' +
'curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh && ' +
'echo && read -n 1 -s -r -p "Press any key to start Lean" && exit\n');
}
}
Expand Down
18 changes: 13 additions & 5 deletions src/abbreviation/rewriter/AbbreviationRewriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ export class AbbreviationRewriter {

// We don't want replaced symbols (e.g. "\") to trigger abbreviations.
this.dontTrackNewAbbr = true;
let ok = false;
try {
await this.textEditor.edit((builder) => {
ok = await this.textEditor.edit((builder) => {
for (const r of replacements) {
builder.replace(
toVsCodeRange(r.range, this.textEditor.document),
Expand All @@ -170,10 +171,17 @@ export class AbbreviationRewriter {
}
this.dontTrackNewAbbr = false;

this.textEditor.selections = newSelections.map((s) => {
const vr = toVsCodeRange(s, this.textEditor.document);
return new vscode.Selection(vr.start, vr.end);
});
if (ok) {
this.textEditor.selections = newSelections.map((s) => {
const vr = toVsCodeRange(s, this.textEditor.document);
return new vscode.Selection(vr.start, vr.end);
});
}
else {
// Our edit did not succeed, do not update the selections.
// This can happen if `waitForNextTick` waits too long.
console.warn('Unable to replace abbreviation');
}

this.updateState();
}
Expand Down

0 comments on commit ee7f592

Please sign in to comment.