Skip to content
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

replaceAll does not work on some machines #1339

Closed
S4G4R opened this issue Oct 14, 2021 · 1 comment
Closed

replaceAll does not work on some machines #1339

S4G4R opened this issue Oct 14, 2021 · 1 comment

Comments

@S4G4R
Copy link
Contributor

S4G4R commented Oct 14, 2021

There is one known case where we get this trace when using String.replaceAll from src/providers/annotations.ts.

rejected promise not handled within 1 second: TypeError: contentText.replaceAll is not a function
/home/sagar/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/out/bootstrap-fork.js:5
stack trace: TypeError: contentText.replaceAll is not a function
    at evaluated (/home/sagar/calva/src/providers/annotations.ts:57:42)
    at Object.decorateResults (/home/sagar/calva/src/providers/annotations.ts:126:22)
    at /home/sagar/calva/src/evaluate.ts:95:45
    at Generator.next (<anonymous>)
    at /home/sagar/calva/out/evaluate.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/sagar/calva/out/evaluate.js:4:12)
    at /home/sagar/calva/src/evaluate.ts:79:65
    at /home/sagar/calva/src/results-output/results-doc.ts:297:25
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

We can work around it with using replace(/foo/g, "bar"). instead. In fact we are, in #1338. But this is probably rather a symptom about that current assumptions on ECMA levels do not hold.

A comment on this SO answer says that replaceAll was added to Nodejs 15: https://stackoverflow.com/a/1145525/44639
but clearly this works for most Calva users, so this can not be the only issue, since currently VS Code uses Node js 14.16.0.

It is probably not about VS Code/Electron/Chrome/V8 versions either, and not solely a WIndows issue. Here are the specs for a system where replaceAll is missing:

Version: 1.61.0 (user setup)
Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea
Date: 2021-10-07T18:13:09.652Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

Here the specs for two systems where it is not missing:

Version: 1.61.0
Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea
Date: 2021-10-07T18:11:58.853Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0
Version: 1.61.0 (user setup)
Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea
Date: 2021-10-07T18:13:09.652Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19041

There might be something with tsconfig.json and/or webpack.config.js we can use. But really, currently we are pretty clueless.

This caused #1332 and also stops custom command snippets from working.

@PEZ PEZ changed the title replaceAll does not work replaceAll does not work on some machines Oct 14, 2021
@PEZ
Copy link
Collaborator

PEZ commented Oct 25, 2021

This was fixed by #1332

@PEZ PEZ closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants