christianvoigt / argdown

a simple syntax for complex argumentation
https://argdown.org
926 stars 31 forks source link

VSCode extension host breaks down upon usage #207

Open Philosophieizlit opened 3 years ago

Philosophieizlit commented 3 years ago

The extension host of VSCode breaks down when I use ArgDown. Especially if there any grammatical issues.

christianvoigt commented 3 years ago

Hi, please add the following information:

I just tested a complex Argdown file in VSCode 1.52.1 with Argdown extension v1.5.3 on Windows 10 and it worked fine (I also tested adding syntax mistakes).

Philosophieizlit commented 3 years ago

VSCode as well as ArgDown is the most recent. I am on Windows 10. The crash happens pretty much at anytime ( if it matters, I keep the Preview of the Map always open to look at the changes, but I have to restart the preview when it crashed).

christianvoigt commented 3 years ago

That is strange. Please check the "Argdown Language Server" and "Argdown" output channels for any error messages (after you opened the Output view under View/Output). If you find any, please post them here.

Please make sure that your VScode version is really 1.52.1. You can check under Help/About. We have to find a way for me to reproduce your problem.

christianvoigt commented 3 years ago

Also check the "Extension Host" output channel. You can switch channels in the drop down menu at the top of the output view.

Philosophieizlit commented 3 years ago

[2021-01-30 00:17:57.426] [exthost] [info] extension host started [2021-01-30 00:17:57.470] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"} [2021-01-30 00:17:57.471] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/microsoft-authentication/dist/extension.js [2021-01-30 00:17:57.487] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":""} [2021-01-30 00:17:57.487] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/debug-auto-launch/dist/extension [2021-01-30 00:17:57.494] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":""} [2021-01-30 00:17:57.494] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/emmet/dist/node/emmetNodeMain [2021-01-30 00:17:57.509] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":""} [2021-01-30 00:17:57.509] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/git/dist/main [2021-01-30 00:17:57.531] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":""} [2021-01-30 00:17:57.531] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/merge-conflict/dist/mergeConflictMain [2021-01-30 00:17:57.542] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":""} [2021-01-30 00:17:57.542] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/search-result/dist/extension.js [2021-01-30 00:17:57.599] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"} [2021-01-30 00:17:57.599] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/extension.js [2021-01-30 00:17:57.782] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":""} [2021-01-30 00:17:57.782] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/github/dist/extension.js [2021-01-30 00:17:57.814] [exthost] [info] eager extensions activated [2021-01-30 00:17:57.816] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"} [2021-01-30 00:17:57.817] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/github-authentication/dist/extension.js [2021-01-30 00:18:20.433] [exthost] [info] ExtensionService#_doActivateExtension christianvoigt.argdown-vscode {"startup":false,"extensionId":{"value":"christianvoigt.argdown-vscode","_lower":"christianvoigt.argdown-vscode"},"activationEvent":"onLanguage:argdown"} [2021-01-30 00:18:20.434] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/nicks/.vscode/extensions/christianvoigt.argdown-vscode-1.5.3/dist/extensi

This was in the Extension host.

This was in the developer tools.

abstractExtensionService.ts:467 Extension host terminated unexpectedly. Code: 7 Signal: null _onExtensionHostCrashed @ abstractExtensionService.ts:431 notificationsAlerts.ts:40 Extension host terminated unexpectedly. onDidChangeNotification @ notificationsAlerts.ts:36 localProcessExtensionHost.ts:257 Extension Host contextKeyService.ts:420 Element already has context attribute w @ contextKeyService.ts:379 createScoped @ contextKeyService.ts:225 e @ codeEditorWidget.ts:262 _createInstance @ instantiationService.ts:73 createInstance @ instantiationService.ts:73 createReplInput @ repl.ts:594 renderBody @ repl.ts:505 render @ paneview.ts:215 render @ viewPaneContainer.ts:271 onDidAddViewDescriptors @ viewPaneContainer.ts:1307 create @ viewPaneContainer.ts:1033 create @ panecomposite.ts:39 showComposite @ compositePart.ts:197 doOpenComposite @ compositePart.ts:132 openComposite @ compositePart.ts:84 doOpenPanel @ panelPart.ts:461 openPanel @ panelPart.ts:461 run @ panelActions.ts:101 runAction @ actions.ts:184 run @ actions.ts:184 onClick @ actionViewItems.ts:126 (anonymous) @ actionViewItems.ts:126 processImmediate @ internal/timers.js:439

VSCode is on the latest version.

christianvoigt commented 3 years ago

Thanks, the error messages do not tell me anything about what is causing this and I can not reproduce your problem, so I do not know how to help you. I will spend some time on Argdown maintenance soon, so maybe I will come across a similar error while testing (for example #195 sounds similar). I will leave this issue open.

Does the error only occur if you open the preview?

You could try to reinstall the extension. You may have to delete the Argdown folder in ~/.vscode/extensions, otherwise it will probably reinstall it from there.

Philosophieizlit commented 3 years ago

No I think it also happens without preview. But thanks for trying anyway. I like your program using for my studies in philosophy. This is just a minor inconvenience. I use it anyway.

mirkolenz commented 3 years ago

I also experienced this problem. For me, it happened when opening Python files (i.e., in cases where the extension should not be loaded at all). I will try to find a pattern here and comment once I find a way of reliably reproducing this issue. Thanks for all your work!

christianvoigt commented 3 years ago

Thanks for the report, I am in the process or preparing another release that will improve the stability of the extension (I am just struggling with bundling everything up with webpack, otherwise it is ready). Let's hope that this problem is fixed by those changes.

christianvoigt commented 3 years ago

I accidentally closed this in the commit, though it might actually be true that that commit fixed your issues as well. Could you please update to argdown-vscode v1.70 and tell me if the crashes are still occurring?

mirkolenz commented 3 years ago

Hi! I updated to the new version yesterday and still have these problems. I am currently working on LaTeX and Python projects (where Argdown should not be loaded at all), but still suffer from crashes. Here is the output of the developer console from the last crash:

abstractExtensionService.ts:466 Extension host terminated unexpectedly. Code:  7  Signal:  null
_onExtensionHostCrashed @ abstractExtensionService.ts:466

log.ts:197   ERR Extension host terminated unexpectedly. The following extensions were running: vscode.microsoft-authentication, GrapeCity.gc-excelviewer, mechatroner.rainbow-csv, bungcip.better-toml, tamasfe.even-better-toml, vscode.debug-auto-launch, vscode.git, albert.TabOut, christian-kohler.path-intellisense, CoenraadS.bracket-pair-colorizer-2, dqisme.sync-scroll, EditorConfig.EditorConfig, formulahendry.auto-rename-tag, Glavin001.unibeautify-vscode, johnpapa.vscode-peacock, kevinkyang.auto-comment-blocks, mhutchie.git-graph, michelemelluso.gitignore, ms-vsliveshare.vsliveshare, PKief.material-icon-theme, ritwickdey.LiveServer, sandcastle.vscode-open, stkb.rewrap, vincaslt.highlight-matching-tag, ms-toolsai.jupyter, ms-vscode-remote.remote-containers, yzhang.markdown-all-in-one, hilleer.yaml-plus-json, christianvoigt.argdown-vscode, jebbs.plantuml, ms-vscode.js-debug, vscode.github, ms-python.python, svsool.markdown-memo, vscode.github-authentication, vscode.emmet, vscode.merge-conflict, vscode.testing-editor-contributions, eamodio.gitlens, GitHub.vscode-pull-request-github, Gruntfuggly.todo-tree, ms-vscode-remote.remote-wsl, ms-vsliveshare.vsliveshare-audio, ms-python.vscode-pylance, iansan5653.format-python-docstrings, njpwerner.autodocstring, VisualStudioExptTeam.vscodeintellicode

notificationsAlerts.ts:40 Extension host terminated unexpectedly.
onDidChangeNotification @ notificationsAlerts.ts:40

bootstrap-window.js:259 [uncaught exception]: Error: This socket has been ended by the other party
g @ bootstrap-window.js:259

bootstrap-window.js:262 Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:455)
    at v.write (ipc.net.ts:65)
    at v._writeNow (ipc.net.ts:338)
    at Immediate.<anonymous> (ipc.net.ts:329)
    at processImmediate (internal/timers.js:456)
g @ bootstrap-window.js:262

events.js:292 Uncaught Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:455)
    at v.write (ipc.net.ts:65)
    at v._writeNow (ipc.net.ts:338)
    at Immediate.<anonymous> (ipc.net.ts:329)
    at processImmediate (internal/timers.js:456)

bootstrap-window.js:259 [uncaught exception]: Error: This socket has been ended by the other party
g @ bootstrap-window.js:259

bootstrap-window.js:262 Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:455)
    at v.write (ipc.net.ts:65)
    at v._writeNow (ipc.net.ts:338)
    at v.flush (ipc.net.ts:293)
    at v.dispose (ipc.net.ts:279)
    at Object.S [as dispose] (lifecycle.ts:96)
    at i.dispose (ipc.net.ts:687)
    at localProcessExtensionHost.ts:623
g @ bootstrap-window.js:262

events.js:292 Uncaught Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:455)
    at v.write (ipc.net.ts:65)
    at v._writeNow (ipc.net.ts:338)
    at v.flush (ipc.net.ts:293)
    at v.dispose (ipc.net.ts:279)
    at Object.S [as dispose] (lifecycle.ts:96)
    at i.dispose (ipc.net.ts:687)
    at localProcessExtensionHost.ts:623

localProcessExtensionHost.ts:266 ../.vscode/extensions/christianvoigt.argdown-vscode-1.7.0/dist/vendors-node_modules_argdown_markdown-it-plugin_dist_argdown-markdown-it-plugin_js-node_modul-83c13a.js:2

My current solution to this issue is to disable the extension globally and only enable it when needed. Thanks for all your efforts!

christianvoigt commented 3 years ago

Thanks for testing. I am sorry that this still causes problems.

only enable it when needed

Does this mean that it works sometimes?

The extension is activated

Does your workspace contain Argdown files? If so, try moving them outside of your workspace.

Maybe I could remove that first activation event, I am not sure if it is needed.

christianvoigt commented 3 years ago

Another explanation could be that there are other files that use the same extensions as Argdown. The Argdown extension currently accepts the following extensions: .argdown, .ad, .argdn, .adown.

Could you search in your workspace if you have any such files in there? Maybe the Argdown extension tries to parse files that it should not parse.

mirkolenz commented 3 years ago

To be honest, I just started with Argdown and never tried to create argument graphs in VSCode (in our team, we heavily rely on Walton's Argumentation Schemes and as far as I can tell, these are currently not supported by Argdown, thus we are evaluating whether we could extend the syntax).

I just double checked and there are no Argdown files (or files having the same extension) in my workspace. Could it be caused by Markdown files being in the workspace? I have a README.md file that does not contain an Argdown code block, but maybe that could also lead to an activation of the extension?

Another idea I had: I have a folder .venv in my workspace which contains a relatively large virtual environment. Maybe Argdown tries to find a matching file in there and crashes when doing so?

christianvoigt commented 3 years ago

Okay, let's try something out:

Could you open the following file: Mac, Linux: $HOME/. vscode/extensions/christianvoigt.argdown-vscode-1.7.0/package.json Windows: %USERPROFILE%\. vscode\extensions\christianvoigt.argdown-vscode-1.7.0/package.json

Search for "workspaceContains:**/*.{argdown,ad,argdn,adown}" and remove that line.

Then restart VSCode (and enable the Argdown extension).

I think this should work and remove the activation event.

christianvoigt commented 3 years ago

If that doesn't work, you could experiment with the other activationEvents in the package.json, but I think this is our best bet.

christianvoigt commented 3 years ago

I created a new feature request for adding "critical questions" to Argdown. At the moment there are still too many conceptual questions to be answered to implement this, but I think it is important to think about this.

I also described how I would work around Argdown's current limitation.

mirkolenz commented 3 years ago

I just commented the specified activation event and so far had no crashes (so the glob could be the root cause of the crash for deeply nested workspaces). However, when looking at the active extensions (Developer: Show Running Extensions), Argdown is still listed there.

Maybe this additional information is helpful for you: When opening a new VSCode workspace, the extension is not loaded initially. However, when changing the syntax type of the newly created file to markdown, Argdown is loaded even though the file is completely empty. As I have a few Markdown documents in my workspace, this could explain why the extension is loaded.

christianvoigt commented 3 years ago

Yes, the Argdown extension is

If you are experiencing problems even after removing the glob, you can also try to deactivate this behaviour in the package.json:

These are the lines that register the Markdown-It plugin:

    "markdown.markdownItPlugins": true,
    "markdown.previewStyles": [
      "./node_modules/@argdown/web-components/dist/argdown-map.css"
    ],
    "markdown.previewScripts": [
      "./node_modules/@argdown/web-components/dist/argdown-map.js"
    ],

You can also use the setting argdown.markdownWebComponent.enabled and set it to false.

These are the lines that add Argdown code highlighting to Markdown files:

      {
        "scopeName": "markdown.argdown.codeblock",
        "path": "./syntaxes/inject-argdown-into-markdown.json",
        "injectTo": [
          "text.html.markdown"
        ],
        "embeddedLanguages": {
          "meta.embedded.block.argdown": "argdown"
        }
      }
mirkolenz commented 3 years ago

The crash just happened again. I will try to set argdown.markdownWebComponent.enabled to false as a first step and try your other suggestions in case the crash happens again. Thanks for your help!

mirkolenz commented 3 years ago

Ok, the crash just happened again. After removing all lines that are related to the Markdown support, the Argdown extension no longer appears in the list of loaded extensions.

Could the previous crashs maybe be related to conflicts with other extensions?

christianvoigt commented 3 years ago

Thanks, this is really very helpful and I think we are finally making progress here!

Just to be sure, could you uncomment the line with the file glob, just to make sure that this is only caused by the Markdown-It plugin?

Do you use any other extensions that work with Markdown files in any way (e.g. Mermaid, Markdown Preview Enhanced and so on)? Would you mind posting a list of your installed extensions? Maybe this would make it finally possible for me to reproduce your issue!

christianvoigt commented 3 years ago

I think after our investigations I can now produce the same error in my VSCode installation, though not reliably. The extension host sometimes crashes if I open or edit Markdown files that do not contain any Argdown code fences. But I do not know yet what exactly triggers the error.

Did you have any crashes after you deactivated the Argdown Markdown-It plugin? Did those crashes occur when you were editing/opening Markdown files or did they also occur if the workspace folder simply contained Markdown files?

My crashes were happening while a Markdown editor, but no preview was open, so I think this has to be caused during the initialization of the Markdown engine itself, not during rendering.

mirkolenz commented 3 years ago

Sorry for the late answer, I am quite busy at the moment. Since disabling the Markdown-It plugin, I did not see any crashes at all. I just uncommented the activation event based on file globs and will let you know if I run into crashes in the future. Here are all extensions that I currently use (some of which will naturally provide other Markdown-It plugins, for example PlantUML and extensions adding language support for YAML etc.):

albert.TabOut
betterthantomorrow.calva
bmewburn.vscode-intelephense-client
bungcip.better-toml
christian-kohler.path-intellisense
christianvoigt.argdown-vscode
codezombiech.gitignore
CoenraadS.bracket-pair-colorizer-2
DavidAnson.vscode-markdownlint
deerawan.vscode-dash
dinhani.divider
DotJoshJohnson.xml
DougFinke.vscode-pandoc
dqisme.sync-scroll
dracula-theme-pro.theme-dracula-pro
dsznajder.es7-react-js-snippets
eamodio.gitlens
EditorConfig.EditorConfig
eg2.vscode-npm-script
eiminsasete.apacheconf-snippets
eriklynd.json-tools
esbenp.prettier-vscode
eseom.nunjucks-template
felixfbecker.php-debug
formulahendry.auto-rename-tag
formulahendry.code-runner
foxundermoon.shell-format
GitHub.vscode-pull-request-github
Glavin001.unibeautify-vscode
golang.go
Goopware.raythis
GrapeCity.gc-excelviewer
Gruntfuggly.todo-tree
guyskk.language-cython
hilleer.yaml-plus-json
humao.rest-client
iansan5653.format-python-docstrings
idleberg.applescript
Ikuyadeu.r
Ikuyadeu.r-pack
James-Yu.latex-workshop
jebbs.plantuml
jianbingfang.dupchecker
joaompinto.vscode-graphviz
johnpapa.vscode-peacock
jspolancor.presentationmode
kevinkyang.auto-comment-blocks
kortina.vscode-markdown-notes
kumar-harsh.graphql-for-vscode
le0zh.vscode-regexp-preivew
lostintangent.vsls-whiteboard
lunaryorn.fish-ide
mads-hartmann.bash-ide-vscode
mechatroner.rainbow-csv
mhutchie.git-graph
michelemelluso.gitignore
mikestead.dotenv
mrmlnc.vscode-apache
ms-azuretools.vscode-docker
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.makefile-tools
ms-vscode.vscode-typescript-tslint-plugin
ms-vsliveshare.vsliveshare
ms-vsliveshare.vsliveshare-audio
ms-vsliveshare.vsliveshare-pack
msjsdiag.debugger-for-chrome
msjsdiag.vscode-react-native
nickdemayo.vscode-json-editor
njpwerner.autodocstring
okitavera.vscode-nunjucks-formatter
PKief.material-icon-theme
PKief.material-product-icons
pnp.polacode
quicktype.quicktype
RandomFractalsInc.vscode-data-preview
rebornix.ruby
redhat.java
redhat.vscode-xml
redhat.vscode-yaml
REditorSupport.r-lsp
richie5um2.vscode-sort-json
ritwickdey.live-sass
ritwickdey.LiveServer
rogalmic.bash-debug
samuelcolvin.jinjahtml
sandcastle.vscode-open
scala-lang.scala
scala-lang.scala-snippets
shengchen.vscode-checkstyle
skyapps.fish-vscode
stardog-union.stardog-rdf-grammars
stkb.rewrap
streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-german
sumneko.lua
svsool.markdown-memo
tamasfe.even-better-toml
timonwong.shellcheck
tushortz.java-imports-snippets
Tyriar.lorem-ipsum
uctakeoff.vscode-counter
valentjn.vscode-ltex
vincaslt.highlight-matching-tag
VisualStudioExptTeam.vscodeintellicode
vscjava.vscode-java-debug
vscjava.vscode-java-dependency
vscjava.vscode-java-pack
vscjava.vscode-java-test
vscjava.vscode-maven
wingrunr21.vscode-ruby
yhirose.FilterText
ymotongpoo.licenser
yzhang.markdown-all-in-one
ziyasal.vscode-open-in-github

For me, the crashes also happened when not having open a Markdown file at all. It was sufficient so have one in the file tree. So I also think that the crash is not related to rendering, but to the initialization.

christianvoigt commented 3 years ago

Thanks! At least I know enough now to start experimenting. I can now comment out parts of the Markdown-It-plugin initialization code and test if the crashes will still occur. Not the ideal way of debugging, but better than nothing.

christianvoigt commented 3 years ago

I had to work on some other things in the last weeks, but today I reserved for hunting this bug down and once again I failed to reproduce it. I opened all kinds of different projects with Markdown files, Python venv folders, Argdown files and so on. The extension host never crashed, which is surprising as I managed to do so last time I tried.

@MirkoLenz, sorry to bother you again, could you maybe make your project folder available to me where you experienced the extension host crashes? I understand if this is not possible, but it would help me to finally pin this bug down and maybe you have an open-source project where this occurs.

@ggbetz, you also told me that you experienced this issue, could you send me a project folder to reproduce this issue?

Maybe the newest VSCode version fixed this bug all by itself, but this is probably only wishful thinking.

mirkolenz commented 3 years ago

Sorry for answering a bit late, but I have been quite busy in the last weeks. I tried to reproduce this bug today but strangely have not been successful so far. As I made some modifications to the extension (removing some startup conditions and so on), I uninstalled the extension, reloaded VSCode, and installed Argdown again. However, the extension does not show in the list of running extensions. So your assumption about VSCode fixing it could be right indeed!

I will observe the behavior and chime in once I am able to provide you with a project that triggers this crash.

maparent commented 1 year ago

Another data point. M1 Mac, everything up-to-date. The extension server crashed repeatedly while editing a basic markdown file (without preview). Disabling argdown solved the problem. But re-enabling it did not make the problem come back. Quite puzzled.