diff --git a/package.json b/package.json index 9c014ef62..65246e030 100644 --- a/package.json +++ b/package.json @@ -211,16 +211,7 @@ "when": "metals:enabled" } ] - }, - "debuggers": [ - { - "type": "scala", - "label": "Scala Debugger", - "languages": [ - "scala" - ] - } - ] + } }, "main": "./out/extension", "scripts": { diff --git a/src/MetalsFeatures.ts b/src/MetalsFeatures.ts index 685b87444..4c441979c 100644 --- a/src/MetalsFeatures.ts +++ b/src/MetalsFeatures.ts @@ -5,12 +5,9 @@ import { } from "vscode-languageclient"; export interface TreeViewProvider {} -export interface DebuggingProvider {} export class MetalsFeatures implements StaticFeature { treeViewProvider?: TreeViewProvider; - debuggingProvider?: DebuggingProvider; - fillInitializeParams(params: InitializeParams): void { if (!params.capabilities.experimental) { params.capabilities.experimental = {}; @@ -21,7 +18,6 @@ export class MetalsFeatures implements StaticFeature { initialize(capabilities: ServerCapabilities): void { if (capabilities.experimental) { this.treeViewProvider = capabilities.experimental.treeViewProvider; - this.debuggingProvider = capabilities.experimental.debuggingProvider; } } } diff --git a/src/client-commands.ts b/src/client-commands.ts index 7d1725bc7..7fc25cb7a 100644 --- a/src/client-commands.ts +++ b/src/client-commands.ts @@ -4,6 +4,5 @@ export const ClientCommands = { toggleLogs: "metals-logs-toggle", focusDiagnostics: "metals-diagnostics-focus", - runDoctor: "metals-doctor-run", - startDebugSession: "metals-debug-session-start" + runDoctor: "metals-doctor-run" }; diff --git a/src/extension.ts b/src/extension.ts index 47fd07dff..6e5cb03a8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,9 +7,6 @@ import { ExtensionContext, window, commands, - CodeLens, - CodeLensProvider, - EventEmitter, StatusBarAlignment, ProgressLocation, IndentAction, @@ -22,7 +19,6 @@ import { Uri, Range, Selection, - TextDocument as VscodeTextDocument, TextEditorRevealType, TextEditor } from "vscode"; @@ -57,7 +53,6 @@ import { getJavaOptions } from "./getJavaOptions"; import { startTreeView } from "./treeview"; import { MetalsFeatures } from "./MetalsFeatures"; import { MetalsTreeViewReveal, MetalsTreeViews } from "./tree-view-protocol"; -import * as scalaDebugger from "./scalaDebugger"; const outputChannel = window.createOutputChannel("Metals"); const openSettingsAction = "Open settings"; @@ -334,40 +329,12 @@ function launchMetals( client.outputChannel.show(true); channelOpen = true; } - }, - startDebugSession: args => { - if (!features.debuggingProvider) return; - - scalaDebugger.start(args).then(wasStarted => { - if (!wasStarted) { - window.showErrorMessage("Debug session not started"); - } - }); } }; Object.entries(clientCommands).forEach(([name, command]) => registerCommand(name, command) ); - // should be the compilation of a currently opened file - // but some race conditions may apply - let compilationDoneEmitter = new EventEmitter(); - - let codeLensRefresher: CodeLensProvider = { - onDidChangeCodeLenses: compilationDoneEmitter.event, - provideCodeLenses: ( - document: VscodeTextDocument, - token: CancellationToken - ) => undefined, - resolveCodeLens: (codeLens: CodeLens, token: CancellationToken) => - undefined - }; - - languages.registerCodeLensProvider( - { scheme: "file", language: "scala" }, - codeLensRefresher - ); - // Handle the metals/executeClientCommand extension notification. client.onNotification(ExecuteClientCommand.type, params => { const isRun = params.command === "metals-doctor-run"; @@ -401,9 +368,6 @@ function launchMetals( }); } break; - case "metals-model-refresh": - compilationDoneEmitter.fire(); - break; default: outputChannel.appendLine(`unknown command: ${params.command}`); } @@ -576,14 +540,6 @@ function launchMetals( treeViews = startTreeView(client, outputChannel, context, viewIds); context.subscriptions.concat(treeViews.disposables); } - if (features.debuggingProvider) { - scalaDebugger - .initialize(outputChannel) - .forEach(disposable => context.subscriptions.push(disposable)); - registerCommand(scalaDebugger.startSessionCommand, scalaDebugger.start); - } else { - outputChannel.appendLine("Debugging Scala sources is not supported"); - } }); } diff --git a/src/scalaDebugger.ts b/src/scalaDebugger.ts deleted file mode 100644 index d8e63b9c7..000000000 --- a/src/scalaDebugger.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as vscode from "vscode"; -import { - CancellationToken, - DebugConfiguration, - Disposable, - ProviderResult, - WorkspaceFolder -} 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[] { - outputChannel.appendLine("Initializing Scala Debugger"); - return [ - vscode.debug.registerDebugConfigurationProvider( - configurationType, - new ScalaConfigProvider() - ) - ]; -} - -export async function start(parameters: any): Promise { - return vscode.commands - .executeCommand(startAdapterCommand, parameters) - .then(response => { - if (response === undefined) return false; - - const debugServer = vscode.Uri.parse(response.uri); - const segments = debugServer.authority.split(":"); - const port = parseInt(segments[segments.length - 1]); - - const configuration: vscode.DebugConfiguration = { - type: configurationType, - name: response.name, - request: "launch", - debugServer: port // note: MUST be a number. vscode magic - automatically connects to the server - }; - - return vscode.debug.startDebugging(undefined, configuration); - }); -} - -class ScalaConfigProvider implements vscode.DebugConfigurationProvider { - provideDebugConfigurations( - folder: WorkspaceFolder | undefined, - token?: CancellationToken - ): ProviderResult { - return []; - } - - resolveDebugConfiguration( - folder: WorkspaceFolder | undefined, - debugConfiguration: DebugConfiguration, - token?: CancellationToken - ): ProviderResult { - return debugConfiguration; - } -} - -export interface DebugSession { - name: string; - uri: string; -}