-
Notifications
You must be signed in to change notification settings - Fork 207
feat: vscode extension #4104
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
base: main
Are you sure you want to change the base?
feat: vscode extension #4104
Conversation
8a0b89e
to
2673372
Compare
|
||
import * as path from 'path' | ||
|
||
const folderName = path.basename(__dirname) |
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.
FOLDER_NAME
?
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.
it's just local to this folder and it is boilerplate.
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React |
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.
example file
vscode/react/src/logo.svg
Outdated
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.
react logo
vscode/react/src/hooks/vscode.ts
Outdated
// 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, | ||
}, '*'); |
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.
maybe just use object directly payload: { ... }
?
vscode/react/index.html
Outdated
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.
example file ?
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.
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'; |
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.
example ?
webviewView.webview.onDidReceiveMessage( | ||
async (message) => { | ||
console.log("message received", message); | ||
if (message && message.key) { |
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.
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 ?
if (_api) { | ||
return _api | ||
} | ||
_api = await PythonExtension.api() |
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.
maybe _api = _api || await PythonExtension.api()
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 | ||
}) | ||
}), |
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.
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
const level = logLevelToTrace(channelLogLevel <= globalLogLevel ? channelLogLevel : globalLogLevel) | ||
return level | ||
} |
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.
maybe just return logLevelToTrace(channelLogLevel <= globalLogLevel ? channelLogLevel : globalLogLevel)
5cc30c2
to
daa2f80
Compare
a169a38
to
979751e
Compare
29314f9
to
8906f30
Compare
a0f2e94
to
2838b9c
Compare
2838b9c
to
1a583fc
Compare
Initial scope: