-
Notifications
You must be signed in to change notification settings - Fork 62
Show document with server debug info #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||||
import * as vscode from "vscode"; | ||||||||||||
import { ExecuteCommandRequest, LanguageClient } from "vscode-languageclient/node"; | ||||||||||||
import { LanguageClient } from "vscode-languageclient/node"; | ||||||||||||
import { LazyOutputChannel, logger } from "./common/logger"; | ||||||||||||
import { | ||||||||||||
checkVersion, | ||||||||||||
|
@@ -24,12 +24,21 @@ import { | |||||||||||
registerCommand, | ||||||||||||
} from "./common/vscodeapi"; | ||||||||||||
import { getProjectRoot } from "./common/utilities"; | ||||||||||||
import { executeAutofix, executeFormat, executeOrganizeImports } from "./common/commands"; | ||||||||||||
import { | ||||||||||||
executeAutofix, | ||||||||||||
executeFormat, | ||||||||||||
executeOrganizeImports, | ||||||||||||
createDebugInformationProvider, | ||||||||||||
} from "./common/commands"; | ||||||||||||
|
||||||||||||
let lsClient: LanguageClient | undefined; | ||||||||||||
let restartInProgress = false; | ||||||||||||
let restartQueued = false; | ||||||||||||
|
||||||||||||
function getClient(): LanguageClient | undefined { | ||||||||||||
return lsClient; | ||||||||||||
} | ||||||||||||
|
||||||||||||
export async function activate(context: vscode.ExtensionContext): Promise<void> { | ||||||||||||
// This is required to get server name and module. This should be | ||||||||||||
// the first thing that we do in this extension. | ||||||||||||
|
@@ -188,26 +197,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<void> | |||||||||||
await executeOrganizeImports(lsClient, serverId); | ||||||||||||
} | ||||||||||||
}), | ||||||||||||
registerCommand(`${serverId}.debugInformation`, async () => { | ||||||||||||
let configuration = getConfiguration(serverId) as unknown as ISettings; | ||||||||||||
if (!lsClient || !configuration.nativeServer) { | ||||||||||||
return; | ||||||||||||
} | ||||||||||||
|
||||||||||||
const editor = vscode.window.activeTextEditor; | ||||||||||||
const params = { | ||||||||||||
command: `${serverId}.printDebugInformation`, | ||||||||||||
arguments: [ | ||||||||||||
{ | ||||||||||||
textDocument: editor ? { uri: editor.document.uri.toString() } : null, | ||||||||||||
}, | ||||||||||||
], | ||||||||||||
}; | ||||||||||||
|
||||||||||||
await lsClient.sendRequest(ExecuteCommandRequest.type, params).then(undefined, async () => { | ||||||||||||
vscode.window.showErrorMessage("Failed to print debug information."); | ||||||||||||
}); | ||||||||||||
}), | ||||||||||||
registerCommand( | ||||||||||||
`${serverId}.debugInformation`, | ||||||||||||
createDebugInformationProvider(getClient, serverId, context), | ||||||||||||
), | ||||||||||||
Comment on lines
+200
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to avoid creating the command if it is the native server? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. Looking at https://code.visualstudio.com/api/references/contribution-points#contributes.commands, we need to add it to the UI via Lines 434 to 438 in b4e0698
|
||||||||||||
registerLanguageStatusItem(serverId, serverName, `${serverId}.showLogs`), | ||||||||||||
); | ||||||||||||
|
||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this in this PR from
main
to check if we're in a notebook context and then use text document. I don't think there's any specific information for a notebook cell so using a notebook for them should be fine.