renpy / vscode-language-renpy

Ren'Py extension for Visual Studio Code
Other
103 stars 21 forks source link

Color picker breaks when rpy file becomes invalid syntax and doesn't recover #364

Closed Konayachi closed 2 months ago

Konayachi commented 1 year ago

Extension version

2.2.2, 2.3.6

Issue description

When UI loads/reloads, extension works as expected. If I modify the file such that the syntax becomes wrong, the extension breaks and the color pickers disappear (see video). The only way to get them back is with a complete UI is reload.

https://github.com/LuqueDaniel/vscode-language-renpy/assets/65081458/c23c7773-7218-45cd-8e0b-491b344281d5

I notice this also happens when I change to other longer files but I can't find how to reproduce it reliably.

Scope inspector screenshots

2023-07-16_02-00 2023-07-16_02-01 2023-07-16_02-01_1 2023-07-16_02-01_2 2023-07-16_02-02 2023-07-16_02-02_1

Code

define gui.selected_color = '#ffffff'
define gui.insensitive_color = '#8996be'
Konayachi commented 1 year ago

I found the logs. Unfortunately it has personal data so I'm unsure about sharing the whole file but I found this:

[Default] > Ren'Py extension deactivating

Is this expected to see in the log file when the issue in the video happens?

brunoais commented 11 months ago

I decided to take a look at this. When the color is temporarily invalid (while the user is typing or even changing using the picker) this appears in the console:

[error] SyntaxError: Invalid flags: dgm
    at _ (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:114:74341)
    at Array.l (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:114:3580)
    at Object.parse (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:114:71938)
    at a.parse (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:1:12591)
    at Object.parse (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:114:415)
    at i (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:52:165)
    at Array.get [as indices] (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/gruntfuggly.todo-tree-0.0.215-universal/dist/extension.js:52:2895)
    at g.applyCaptures (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:263709)
    at g.executeMatchPattern (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:268453)
    at g.applyScanResult (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:269292)
    at g.executePattern (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:269998)
    at g.tokenize (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:263109)
    at p.runTokenizer (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:259273)
    at p.tokenizeDocument (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:259022)
    at h (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:2185)
    at l (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:957)
    at /home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:4424
    at new Promise (<anonymous>)
    at Object.provideDocumentColors (/home/user/.var/app/com.vscodium.codium/data/codium/extensions/luquedaniel.languague-renpy-2.2.2-universal/dist/extension.js:2:4405)
    at Z.provideColors (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:127:70841)
    at /app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:127:90351
    at ve._withAdapter (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:127:76751)
    at ve.$provideDocumentColors (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:127:90327)
    at i._doInvokeHandler (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:134:13722)
    at i._invokeHandler (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:134:13404)
    at i._receiveRequest (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:134:12120)
    at i._receiveOneMessage (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:134:10873)
    at s.value (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:134:8936)
    at c._deliver (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2465)
    at c.fire (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2784)
    at g.fire (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:96:16738)
    at s.value (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:9484)
    at c._deliver (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2465)
    at c.fire (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2784)
    at g.fire (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:96:16738)
    at MessagePortMain.<anonymous> (/app/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:153:7561)
    at MessagePortMain.emit (node:events:513:28)
    at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367)

I hope this helps getting this bug fixed

duckdoom4 commented 7 months ago

Thanks for the stack trace, that might help me find the issue.

As for why this happened; the plugin crashes, causing it to shutdown until you restart visual studio and/or maybe if you open another renpy file

duckdoom4 commented 2 months ago

I did come across this crash and have included a fix in #410. I'll mark it as resolved, it should be available in the next release. (Note that you will then have to update to the new official renpy extension!)