Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions rascal-vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,22 @@
"command": "rascalmpl.startDebuggerForRepl",
"title": "Start Rascal debugger for REPL",
"icon": "$(debug)"
},
{
"command": "rascalmpl.copySourceLocation",
"title": "Copy Path as Rascal Location",
"icon": "$(copy)"
}
],
"menus": {
"commandPalette": [
{
"command": "rascalmpl.startDebuggerForRepl",
"when": "false"
},
{
"command": "rascalmpl.copySourceLocation",
"when": "false"
}
],
"view/item/context": [
Expand All @@ -67,6 +76,12 @@
"when": "view == rascalmpl-debugger-view && viewItem == 'canStartDebugging'",
"group": "inline"
}
],
"explorer/context": [
{
"command": "rascalmpl.copySourceLocation",
"group": "6_copypath@21"
}
]
},
"languages": [
Expand Down
12 changes: 11 additions & 1 deletion rascal-vscode-extension/src/RascalExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as os from 'os';
import * as path from 'path';
import * as vscode from 'vscode';

import { integer } from'vscode-languageclient';
import { integer, URI } from'vscode-languageclient';
import { checkForJVMUpdate, getJavaExecutable } from './auto-jvm/JavaLookup';
import { RascalLanguageServer } from './lsp/RascalLanguageServer';
import { LanguageParameter, ParameterizedLanguageServer } from './lsp/ParameterizedLanguageServer';
Expand All @@ -53,6 +53,7 @@ export class RascalExtension implements vscode.Disposable {
this.registerTerminalCommand();
this.registerMainRun();
this.registerImportModule();
this.registerCopySourceLocationCommand();
checkForJVMUpdate();

vscode.window.registerTreeDataProvider('rascalmpl-configuration-view', new RascalLibraryProvider(this.rascal.rascalClient));
Expand Down Expand Up @@ -105,6 +106,15 @@ export class RascalExtension implements vscode.Disposable {
);
}

private registerCopySourceLocationCommand() {
this.context.subscriptions.push(
vscode.commands.registerCommand("rascalmpl.copySourceLocation", async (uri: URI) => {
const rascalUri = `|${decodeURIComponent(uri)}|`;
await vscode.env.clipboard.writeText(rascalUri);
})
);
}

private async startTerminal(uri: vscode.Uri | undefined, command?: string | undefined) {
try {
await vscode.window.withProgress({
Expand Down
Loading