"print" is not defined when connecting with the worker from pyright-browser
#888
-
Hello, I am trying to implement a full browser example for python LSP but when I connect the worker returned from pyright-browser I get an error highlighting for any idea why is this error happening ? here is the part that I changed in the wrapper config const worker = new Worker(
"./../../../../../node_modules/@typefox/pyright-browser/dist/pyright.worker.js"
);
// Send the `boot` request to the language server
// This starts the language server and a nested worker that performs the language analysis.
worker.postMessage({
type: "browser/boot",
mode: "foreground",
});
const wrapperConfig: WrapperConfig = {
$type: "extended",
htmlContainer: configParams.htmlContainer,
logLevel: LogLevel.Debug,
languageClientConfigs: {
python: {
name: "Python Language Server Example",
connection: {
options: {
$type: "WorkerDirect",
worker: worker,
},
},
clientOptions: {
documentSelector: [configParams.languageId],
workspaceFolder: {
index: 0,
name: configParams.workspaceRoot,
uri: vscode.Uri.parse(configParams.workspaceRoot),
},
},
},
}, here is the error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @ahmed-s-fatahallah, the pyright-browser package does not come with any builtins (i.e. also no Note that the pyright-browser package is effectively unmaintained and hasn't been updated in the last 2 years. I would recommend you to either build your own bundle or use a more popular fork of pyright which adds browser support. |
Beta Was this translation helpful? Give feedback.
Hey @ahmed-s-fatahallah,
the pyright-browser package does not come with any builtins (i.e. also no
print
), as it does not have access to the file system. See also #561 (specially 1, 2, 3) which describes a solution for how to load builtins on startup.Note that the pyright-browser package is effectively unmaintained and hasn't been updated in the last 2 years. I would recommend you to either build your own bundle or use a more popular fork of pyright which adds browser support.