microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.88k stars 29.16k forks source link

VSCode syntax highlighting is gone! #165225

Closed AnmSaiful closed 5 months ago

AnmSaiful commented 1 year ago

I've been facing this for the last couple of months in Windows and macOS.

I'm not sure exactly when this starts happening, perhaps after a VSCode update or an OS update.

Here's a screenshot for demonstration, which contains a TypeScript code:

image

This also happens with other languages like PHP.

Does this issue occur when all extensions are disabled?: Yes

amal-khailtash commented 1 year ago

I seem to have encountered the same issue with 1.72.1. I have tried older versions and I cannot get back syntax highlighting. I deleted all my data directory and user settings and restarted from scratch, fresh, but no change! Even json settings file is not highlighted anymore!

amal-khailtash commented 1 year ago

Not sure if it is a related issue, but I cannot launch debugger (gdb) at all. Debugger seems to just die with no messages!

AnmSaiful commented 1 year ago

Please note that the behavior of the issue is unstable. Since the issue was raised for the first time, I also got back the syntax highlighting a couple of times, and it's gone a couple of times afterward.

I guess it happens with VSCode updates.

amal-khailtash commented 1 year ago

Keyword highlight is gone as well as comments, ...

RedCMD commented 1 year ago

Seems the Textmate highlighting has stopped but semantic highlighting still works I assume ctrl+click definitions etc still work

is syntax highlighting broken for every single language? 3rd party extensions? or just the builtin ones?

amal-khailtash commented 1 year ago

I never used ctrl-click, but if I press F12 or go to definition, it works. Syntax highlighting is pretty much broken for every language, built-in or otherwise.

amal-khailtash commented 1 year ago

If it helps, here is the version and the list of extensions I use:

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T03:54:53.913Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 3.10.0-1160.66.1.el7.x86_64
Sandboxed: No

$ code --list-extensions --show-versions
aaron-bond.better-comments@3.0.2
akiramiyakoda.cppincludeguard@1.6.0
albert.TabOut@0.2.2
alefragnani.Bookmarks@13.3.1
alefragnani.numbered-bookmarks@8.3.1
bitwisecook.tcl@0.4.0
BriteSnow.vscode-toggle-quotes@0.3.6
dbankier.vscode-quick-select@0.2.9
Gruntfuggly.todo-tree@0.0.220
janjoerke.align-by-regex@1.0.4
jeff-hykin.better-cpp-syntax@1.16.3
jock.svg@1.4.22
mechatroner.rainbow-csv@3.3.0
ms-python.python@2022.16.1
ms-python.vscode-pylance@2022.11.20
ms-toolsai.jupyter@2022.9.1202862440
ms-toolsai.jupyter-keymap@1.0.0
ms-toolsai.jupyter-renderers@1.0.10
ms-toolsai.vscode-jupyter-cell-tags@0.1.6
ms-toolsai.vscode-jupyter-slideshow@0.1.5
ms-vscode.cpptools@1.12.4
PKief.material-icon-theme@4.22.0
purplestone.savebackup@0.0.4
rebornix.ruby@0.28.1
seanwu.vscode-qt-for-python@3.0.1
tdennis4496.cmantic@0.9.0
wayou.vscode-todo-highlight@1.0.5
wingrunr21.vscode-ruby@0.28.0
wwm.better-align@1.1.6
amal-khailtash commented 1 year ago

Deleted all extensions and (user) settings and started fresh and this is still a problem:

I am not sure if the problem is with the specific machine I am on:

$ uname -a
Linux atlsde7-reg0827 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed Apr 27 20:34:34 UTC 2022 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
amal-khailtash commented 1 year ago

No matter what I do, I cannot get back the syntax highlighting. It used to work, but all of a sudden it is gone forever!

RedCMD commented 1 year ago

what does Keyboard Shortcuts > editor.action.inspectTMScopes say?

amal-khailtash commented 1 year ago

No binding: image

RedCMD commented 1 year ago

sorry assign it a keybind and use it on a document

amal-khailtash commented 1 year ago

I get this: image

RedCMD commented 1 year ago

interesting not sure what that entails the message is the same for all languages?

if its working correctly you should have gotten something like this image

amal-khailtash commented 1 year ago

I opened a Python file and it is interesting that I get this as soon as I open the file:

image

Then with your command, I still get the same error with pretty much every file type, json, py, csh, sh, ...

As I mentioned before, C++ debugger does not start either! Something is really messed up.

The puzzling part is that the binaries are installed by our admin/IT on shared network drives and the installation cannot be corrupted. I also started fresh with all .vscode and .cache/... and extensions completely cleaned.

One other observation is that on our systems, I need to use the --no-sandbox or VSCode never starts. Maybe unrelated, but I thought I mention it.

amal-khailtash commented 1 year ago

Based on the suggestion on that issue, I enabled developer tools, restarted VSCode and I get these messages and errors:

workbench.desktop.main.js:sourcemap:609 CRITI Extension 'ms-toolsai.jupyter' wants API proposal 'notebookDebugOptions' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2workbench.desktop.main.js:sourcemap:609   ERR WebAssembly.instantiate(): Out of memory: wasm memory: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
workbench.desktop.main.js:sourcemap:609  INFO [perf] Render performance baseline is 39ms
workbench.desktop.main.js:sourcemap:87 [Extension Host] activating extension
workbench.desktop.main.js:sourcemap:87 [Extension Host] starting language server
workbench.desktop.main.js:sourcemap:609   ERR [Extension Host] /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy)
workbench.desktop.main.js:sourcemap:87 [Extension Host] /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy)
E @ workbench.desktop.main.js:sourcemap:87
$logExtensionHostMessage @ workbench.desktop.main.js:sourcemap:1743
_doInvokeHandler @ workbench.desktop.main.js:sourcemap:1743
_invokeHandler @ workbench.desktop.main.js:sourcemap:1743
_receiveRequest @ workbench.desktop.main.js:sourcemap:1743
_receiveOneMessage @ workbench.desktop.main.js:sourcemap:1743
(anonymous) @ workbench.desktop.main.js:sourcemap:1743
invoke @ workbench.desktop.main.js:sourcemap:83
deliver @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:546
_receiveMessage @ workbench.desktop.main.js:sourcemap:546
(anonymous) @ workbench.desktop.main.js:sourcemap:546
invoke @ workbench.desktop.main.js:sourcemap:83
deliver @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:83
acceptChunk @ workbench.desktop.main.js:sourcemap:546
(anonymous) @ workbench.desktop.main.js:sourcemap:546
y @ workbench.desktop.main.js:sourcemap:546
emit @ node:events:526
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:190
workbench.desktop.main.js:sourcemap:1994 Extension Host
workbench.desktop.main.js:sourcemap:1994 /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy)
workbench.desktop.main.js:sourcemap:609   ERR [Extension Host] (node:40949) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
workbench.desktop.main.js:sourcemap:87 [Extension Host] (node:40949) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
E @ workbench.desktop.main.js:sourcemap:87
$logExtensionHostMessage @ workbench.desktop.main.js:sourcemap:1743
_doInvokeHandler @ workbench.desktop.main.js:sourcemap:1743
_invokeHandler @ workbench.desktop.main.js:sourcemap:1743
_receiveRequest @ workbench.desktop.main.js:sourcemap:1743
_receiveOneMessage @ workbench.desktop.main.js:sourcemap:1743
(anonymous) @ workbench.desktop.main.js:sourcemap:1743
invoke @ workbench.desktop.main.js:sourcemap:83
deliver @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:546
_receiveMessage @ workbench.desktop.main.js:sourcemap:546
(anonymous) @ workbench.desktop.main.js:sourcemap:546
invoke @ workbench.desktop.main.js:sourcemap:83
deliver @ workbench.desktop.main.js:sourcemap:83
fire @ workbench.desktop.main.js:sourcemap:83
acceptChunk @ workbench.desktop.main.js:sourcemap:546
(anonymous) @ workbench.desktop.main.js:sourcemap:546
y @ workbench.desktop.main.js:sourcemap:546
emit @ node:events:526
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:190
workbench.desktop.main.js:sourcemap:87 [Extension Host] updateCustomBrowseConfiguration
jimmywarting commented 1 year ago

Started to get this same problem also today... Also think this was due to some update or anything. haven't installed any extension or such lately.

CoffeeScript gives some decent syntax color for JavaScript syntax for the time being... but not perfect either.

Version: 1.73.1 (Universal)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:08:38.961Z (1 wk ago)
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No
jimmywarting commented 1 year ago

based on @amal-khailtash comment above i just notices

2workbench.desktop.main.js:sourcemap:609   ERR WebAssembly.instantiate(): 
Out of memory: wasm memory: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory

So... i restarted the computer and the problem was gone... i can use javascript again!

amal-khailtash commented 1 year ago

Unfortunately in my case this is on Linux and nothing has helped so far, even running on different machines.

amal-khailtash commented 1 year ago

Hi @alexdima, Do you need any more information to help with this issue?

DiDeoxy commented 1 year ago

https://github.com/microsoft/vscode/issues/166865

alexdima commented 1 year ago

I heard that the ts nightly extension had a bug. Do you use that by any chance?

Can you try to reproduce with our nightly insider builds? You can give our preview releases a try from: https://code.visualstudio.com/insiders/

Tetrapak0 commented 1 year ago

Try installing an older version of relevant extensions. Worked for me with Pylance

Tetrapak0 commented 1 year ago

Deleted all extensions and (user) settings and started fresh and this is still a problem:

I am not sure if the problem is with the specific machine I am on:

$ uname -a
Linux atlsde7-reg0827 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed Apr 27 20:34:34 UTC 2022 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"

Try installing an older version of the C/C++ extension. Like a month old and then try newer or older

amal-khailtash commented 1 year ago

I tried insider version and also older versions of C/C++ extension, but none of them helped. It seems like something is stuck, like a residue file or some incompatibility.

alexdima commented 1 year ago

@amal-khailtash

Looking again at your errors, it looks like we can't instantiate the vscode-oniguruma web assembly due to an allocation failure (out of memory):

ERR WebAssembly.instantiate(): Out of memory: wasm memory: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory

This failure is catastrophic and we can't recover from it. We need to allocate that web assembly module to do syntax highlighting. Do you have sufficient free memory available on this machine?


Also curious is the following log entry from the C++ extension:

ERR [Extension Host] /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/akhailta/vscode/extensions/ms-vscode.cpptools-1.12.4-linux-x64/LLVM/bin/clang-tidy)


@deepak1556 Do you have any idea what could be going on here?

amal-khailtash commented 1 year ago

This is a VM instance and I have 62G+ memory. I do not think this is a memory issue. But it might be related to GLIBC version. I see this, but no GLIBC_2.27!

$ strings /lib64/libc.so.6 | grep "^GLIBC_"
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE
GLIBC_2.8
GLIBC_2.5
GLIBC_2.9
GLIBC_2.7
GLIBC_2.6
GLIBC_2.11
GLIBC_2.16
GLIBC_2.10
GLIBC_2.17
GLIBC_2.13
GLIBC_2.2.6
alexdima commented 1 year ago

@amal-khailtash Looking on StackOverflow, did you check this out --> https://stackoverflow.com/a/52419631

amal-khailtash commented 1 year ago

I see the virtual memory size is limited to 52G:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 257447
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 5120
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 257447
virtual memory          (kbytes, -v) 52428800
file locks                      (-x) unlimited

$ ulimit -v
52428800
alexdima commented 1 year ago

@amal-khailtash Does syntax coloring work for you when opening https://vscode.dev in Chromium on the same machine?

deepak1556 commented 1 year ago

@amal-khailtash along with the above test, can you also start the application like code --verbose --js-flags="--trace_wasm_memory" and attach the output ?

@alexdima I would be interested to see the result from running https://vscode.dev as well. I can provide a custom build to understand a bit more about the allocation failure depending on that, release builds have some of the memory tracing flags disabled and it is hard to know where it failed.

As for the GLIBC error, @amal-khailtash please report it to https://github.com/microsoft/vscode-cpptools since it is from the clang-tidy binary shipped with the extension.

amal-khailtash commented 1 year ago

Unfortunately, we do not have chromium on our Linux systems so I cannot test https://vscode.dev, but I ran with the suggested flags and the log file is attached. log.zip

amal-khailtash commented 1 year ago

For GLIBC problem, there is already an open issue: microsoft/vscode-cpptools#10019

amal-khailtash commented 1 year ago

@deepak1556 any findings from the log file?

amal-khailtash commented 1 year ago

Ping.

deepak1556 commented 1 year ago

@amal-khailtash sorry for the delay here, nope the logs didn't contain the reports from --trace_wasm_memory since the allocation failures in your case seems to happen earlier to compilation. It happens when initial ArrayBuffer backing store is being allocated for WebAssembly.Instantiate https://source.chromium.org/chromium/chromium/src/+/5436028444db72783f9fe8d4b2ae1b8ff2badb05:v8/src/wasm/module-instantiate.cc;l=1745-1749. To trace the backing store failures, I need to provide you with a debug build which will allow us to use --js-flags="--trace_backing_store". I will provide the build this week, please expect some delay due to ongoing recovery release

AnmSaiful commented 1 year ago

Is there any update on this?

amal-khailtash commented 1 year ago

@deepak1556 please let me know when debug build is available and what options I need to use to run.

amal-khailtash commented 1 year ago

Any more updates on this?

deepak1556 commented 1 year ago

@amal-khailtash the newer runtime builds are taking longer than usual due to CI issues. I will update here once the builds are available. Thanks for understanding!

AnmSaiful commented 1 year ago

This will sound crazy, but after two and half months of the report, I've fixed the issue on my end by removing the following line from settings.json.

{
  "workbench.colorTheme": "Visual Studio Dark"
}
amal-khailtash commented 1 year ago

@AnmSaiful wow! I think you have been lucky. But in my case, I do not have this in my settings.json. I even deleted the settings.json and started code again, but I am still having the same issue! I think in your case, somehow this fixed it. I believe there is something else, a file residue or something, in my home directory that is causing it, for I have even started code fresh by deleting ~/.vscode, and ~/.cache/vscode, ...

My next experiment will be to delete every . file/directory in my home directory and try again. :(

AnmSaiful commented 1 year ago

@amal-khailtash well, here's the whole story:

Today I've done a fresh VSCode installation followed by a complete removal of VSode from my system, including the app and all its settings and data.

On the next launch, I figured out that the issue was fixed. Then I signed in to sync the settings, and the syntax highlighting went again. So I've started removing the setting entries one by one, and with the removal of the workbench.colorTheme settings, it came back again.

So, yes, there could be additional issues solved by the earlier cleaning process, but I was not sure about it, so I just mentioned the one I was sure about.

Hopefully, this will help you and others as well. :-)

amal-khailtash commented 1 year ago

@deepak1556, is this what I need to get? https://github.com/microsoft/vscode/issues/169520. I need to get this resolved, for many people are complaining about it to me.

amal-khailtash commented 1 year ago

Ping! Any updates on this?

amal-khailtash commented 1 year ago

Hi @deepak1556, have you got a debug build for me yet?

deepak1556 commented 1 year ago

@amal-khailtash sorry this has taken longer than expected, I am still waiting on newer runtime builds. I am optimistic to get a build out this week, thanks for your patience!

deepak1556 commented 1 year ago

Runtime builds are running at https://domoreexp.visualstudio.com/Teamspace/_build/results?buildId=18517930&view=results, will update here once they are available.

amal-khailtash commented 1 year ago

I do not have access to this page. But maybe it is not ready yet. Also, please let me know what to do, or if there is any special arguments I need to pass for debugging.

amal-khailtash commented 1 year ago

Wow, this is really taking a long time! This case has been open since Nov last year. No debug build yet? Must have a really good build system :)