Skip to content

Commit

Permalink
Merge branch 'grooming-3'
Browse files Browse the repository at this point in the history
  • Loading branch information
gabro committed Oct 31, 2019
2 parents bbc6c06 + b532d77 commit ba9d370
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 465 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- git checkout -b travis-temp
# change the version in package.json
- yarn version --no-git-tag-version --new-version $NEW_VERSION
- yarn github-changes -o scalameta -r metals-vscode --no-merges -t "VSCode Extension Changelog" -k $GITHUB_TOKEN
- npx github-changes -o scalameta -r metals-vscode --no-merges -t "VSCode Extension Changelog" -k $GITHUB_TOKEN
- sed -i '1i Check out the Metals release notes at [https://scalameta.org/metals/blog/](https://scalameta.org/metals/blog/)\n' CHANGELOG.md
- git commit -am "$TRAVIS_TAG"
# push the changes to package.json
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,14 @@
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "yarn compile && node ./node_modules/vscode/bin/test",
"test": "yarn compile",
"build": "vsce package --yarn",
"vscode:publish": "vsce publish --yarn"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^8.10.25",
"@types/semver": "^5.5.0",
"@types/shell-quote": "^1.6.1",
"github-changes": "^1.1.2",
"typescript": "^3.2.2",
"vsce": "^1.54.0"
},
Expand Down
87 changes: 43 additions & 44 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ function launchMetals(
}
};
Object.entries(clientCommands).forEach(([name, command]) =>
registerCommand(name, command)
registerCommand(
ClientCommands[name as keyof typeof ClientCommands],
command
)
);

// should be the compilation of a currently opened file
Expand All @@ -356,12 +359,7 @@ function launchMetals(

let codeLensRefresher: CodeLensProvider = {
onDidChangeCodeLenses: compilationDoneEmitter.event,
provideCodeLenses: (
document: VscodeTextDocument,
token: CancellationToken
) => undefined,
resolveCodeLens: (codeLens: CodeLens, token: CancellationToken) =>
undefined
provideCodeLenses: () => undefined
};

languages.registerCodeLensProvider(
Expand All @@ -371,43 +369,45 @@ function launchMetals(

// Handle the metals/executeClientCommand extension notification.
client.onNotification(ExecuteClientCommand.type, params => {
const isRun = params.command === "metals-doctor-run";
const isReload = params.command === "metals-doctor-reload";
if (isRun || (doctor && isReload)) {
const html = params.arguments && params.arguments[0];
if (typeof html === "string") {
const panel = getDoctorPanel(isReload);
panel.webview.html = html;
}
} else {
switch (params.command) {
case "metals-goto-location":
const location =
params.arguments && (params.arguments[0] as Location);
if (location) {
workspace
.openTextDocument(Uri.parse(location.uri))
.then(textDocument => window.showTextDocument(textDocument))
.then(editor => {
const range = new Range(
location.range.start.line,
location.range.start.character,
location.range.end.line,
location.range.end.character
);
// Select an offset position instead of range position to
// avoid triggering noisy document highlight.
editor.selection = new Selection(range.start, range.start);
editor.revealRange(range, TextEditorRevealType.InCenter);
});
switch (params.command) {
case "metals-goto-location":
const location =
params.arguments && (params.arguments[0] as Location);
if (location) {
workspace
.openTextDocument(Uri.parse(location.uri))
.then(textDocument => window.showTextDocument(textDocument))
.then(editor => {
const range = new Range(
location.range.start.line,
location.range.start.character,
location.range.end.line,
location.range.end.character
);
// Select an offset position instead of range position to
// avoid triggering noisy document highlight.
editor.selection = new Selection(range.start, range.start);
editor.revealRange(range, TextEditorRevealType.InCenter);
});
}
break;
case "metals-model-refresh":
compilationDoneEmitter.fire();
break;
case "metals-doctor-run":
case "metals-doctor-reload":
const isRun = params.command === "metals-doctor-run";
const isReload = params.command === "metals-doctor-reload";
if (isRun || (doctor && isReload)) {
const html = params.arguments && params.arguments[0];
if (typeof html === "string") {
const panel = getDoctorPanel(isReload);
panel.webview.html = html;
}
break;
case "metals-model-refresh":
compilationDoneEmitter.fire();
break;
default:
outputChannel.appendLine(`unknown command: ${params.command}`);
}
}
break;
default:
outputChannel.appendLine(`unknown command: ${params.command}`);
}

// Ignore other commands since they are less important.
Expand Down Expand Up @@ -581,7 +581,6 @@ function launchMetals(
scalaDebugger
.initialize(outputChannel)
.forEach(disposable => context.subscriptions.push(disposable));
registerCommand(scalaDebugger.startSessionCommand, scalaDebugger.start);
} else {
outputChannel.appendLine("Debugging Scala sources is not supported");
}
Expand Down
1 change: 0 additions & 1 deletion src/scalaDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "vscode";

export const startAdapterCommand = "debug-adapter-start";
export const startSessionCommand = "metals-debug-session-start";
const configurationType = "scala";

export function initialize(outputChannel: vscode.OutputChannel): Disposable[] {
Expand Down
22 changes: 0 additions & 22 deletions src/test/extension.test.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/test/index.ts

This file was deleted.

Loading

0 comments on commit ba9d370

Please sign in to comment.