Skip to content

feat: vscode extension #4104

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: vscode extension #4104

wants to merge 1 commit into from

Conversation

benfdking
Copy link
Contributor

@benfdking benfdking commented Apr 9, 2025

Initial scope:

  • Format code -> through lsp
  • List diagnostics -> through diagnostics
  • Lineage view
    • Jump to model on file change
    • Click on node opens file

@benfdking benfdking force-pushed the vscode_extension branch 5 times, most recently from 8a0b89e to 2673372 Compare April 11, 2025 22:30

import * as path from 'path'

const folderName = path.basename(__dirname)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FOLDER_NAME ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just local to this folder and it is boilerplate.

target="_blank"
rel="noopener noreferrer"
>
Learn React
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

react logo

Comment on lines 9 to 17
// Use a different variable name to avoid conflict with the parameter
const eventPayload = {
key: callbackName,
payload: payload,
}
window.parent.postMessage({
key: "vscode_callback",
payload: eventPayload,
}, '*');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just use object directly payload: { ... }?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example file ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it's the base html

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode'
// import * as myExtension from '../../extension';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example ?

webviewView.webview.onDidReceiveMessage(
async (message) => {
console.log("message received", message);
if (message && message.key) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have a dedicated ConsoleLog() function to use when we need to log something and treat native console.log as part of dev debugging that needs to be removed ?

Comment on lines 22 to 25
if (_api) {
return _api
}
_api = await PythonExtension.api()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe _api = _api || await PythonExtension.api()

Comment on lines 30 to 46
try {
const api = await getPythonExtensionAPI()

if (api) {
disposables.push(
api.environments.onDidChangeActiveEnvironmentPath(async (e) => {
const environment = await api.environments.resolveEnvironment(e.path)
const isVirtualEnv = environment?.environment !== undefined
const binPath = isVirtualEnv ? environment?.environment?.folderUri.fsPath : undefined

onDidChangePythonInterpreterEvent.fire({
path: [e.path],
resource: e.resource?.uri,
isVirtualEnvironment: isVirtualEnv,
binPath
})
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is trying to catch Error initializing python and i think if await getPythonExtensionAPI() returns null that kinda like an error we want to catch here but having if (api) { prevents that

Comment on lines 34 to 36
const level = logLevelToTrace(channelLogLevel <= globalLogLevel ? channelLogLevel : globalLogLevel)
return level
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just return logLevelToTrace(channelLogLevel <= globalLogLevel ? channelLogLevel : globalLogLevel)

@benfdking benfdking marked this pull request as draft April 17, 2025 15:45
@benfdking benfdking force-pushed the vscode_extension branch 8 times, most recently from 5cc30c2 to daa2f80 Compare April 24, 2025 11:47
@benfdking benfdking force-pushed the vscode_extension branch 7 times, most recently from a169a38 to 979751e Compare April 29, 2025 11:14
@benfdking benfdking force-pushed the vscode_extension branch 12 times, most recently from 29314f9 to 8906f30 Compare May 8, 2025 14:17
@benfdking benfdking force-pushed the vscode_extension branch 7 times, most recently from a0f2e94 to 2838b9c Compare May 9, 2025 12:00
@benfdking benfdking force-pushed the vscode_extension branch from 2838b9c to 1a583fc Compare May 9, 2025 12:09
@benfdking benfdking marked this pull request as ready for review May 9, 2025 12:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants