fwcd / vscode-kotlin

Kotlin code completion, debugging, linting and more for VSCode
MIT License
298 stars 41 forks source link

[Bug] Extension seems to be not registered in VSCode #35

Open she11sh0cked opened 4 years ago

she11sh0cked commented 4 years ago

Description

  1. Launching a kotlin debug configuration results in the following error message:

    Couldn't find a debug adapter descriptor for debug type 'kotlin' (extension might have failed to activate)

    And the following error in the developer tools console:

    ERR timeout after 1000 ms: Error: timeout after 1000 ms
      at t.RawDebugSession.handleErrorResponse (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3061:355)
      at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3060:679
      at async t.RawDebugSession.shutdown (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3058:772)
  2. Running "Kotlin: Restart the Language Server" from the Command Palette results in the following error message:

    Command 'Kotlin: Restart the Language Server' resulted in an error (command kotlin.languageServer.restart' not found)

    (the same error is also in developer tools console)

Additional context

There is also no mention of kotlin in my Extension Host log

Reproducing

    1. Create the following debug configuration:

      {
          "version": "0.2.0",
          "configurations": [
              {
                  "type": "kotlin",
                  "request": "launch",
                  "name": "Kotlin Launch",
                  "projectRoot": "${workspaceFolder}",
                  "mainClass": "path.to.your.MainClassKt"
              },
          ]
      }
    2. Launch the configuration

    3. See error

    1. Run "Kotlin: Restart the Language Server" from the Command Palette
    2. See error

Environment

Extension: 0.2.11
VSCode: 1.45.0 microsoft/vscode@d69a79b73808559a91206d73d7717ff5f798f23c
OS: Microsoft Windows 10.0.18363

she11sh0cked commented 4 years ago

Issue solved by first reinstalling VSCode (also deleting %userprofile%/.vscode and %appdata%/Code) and then opening a .kt file. This triggered the installation of the language- and debug server. (Strangly this did only work after reinstalling VSCode)

I'm keeping this issue open because it isn't documented, that you need to open a .kt file to install the the language- and debug server

she11sh0cked commented 4 years ago

Well... I was too fast to comment. It didn't work anymore after I synced my extensions with settings sync.

I get this error in the Developer Tools console after i install or uninstall the vscode-kotlin extension:

Error: Cannot invoke loadWASM more than once. | mainThreadExtensionService.ts:66
    at Object.t.loadWASM (c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-oniguruma\release\main.js:1:4823)
    at TextMateLoader.loadOniguruma (c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\textMateLoader.js:123:19)
    at new TextMateLoader (c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\textMateLoader.js:19:31)
    at new Settings (c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\settings.js:10:31)
    at new DocumentDecorationManager (c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\documentDecorationManager.js:9:25)
    at restart (c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\extension.js:42:37)
    at c:\Users\erikberressem\.vscode\extensions\coenraads.bracket-pair-colorizer-2-0.1.2\out\src\extension.js:7:43
    at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:67)
    at s.deltaExtensions (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:588:215)
    at h.$deltaExtensions (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:830:50)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)

Here is a list of my extensions:

aaron-bond.better-comments
ban.spellright
bierner.emojisense
bierner.markdown-mermaid
bierner.markdown-preview-github-styles
CoenraadS.bracket-pair-colorizer-2
CoenraadS.disableligatures
cssho.vscode-svgviewer
darkriszty.markdown-table-prettify
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
donjayamanne.githistory
DotJoshJohnson.xml
dracula-theme.theme-dracula
drKnoxy.eslint-disable-snippets
dsznajder.es7-react-js-snippets
eamodio.tsl-problem-matcher
fabiospampinato.vscode-statusbar-debugger
formulahendry.code-runner
fwcd.kotlin
Gruntfuggly.todo-tree
hedinne.stylelint-disable-snippets
hnw.vscode-auto-open-markdown-preview
IBM.output-colorizer
kisstkondoros.vscode-gutter-preview
kumar-harsh.graphql-for-vscode
mikestead.dotenv
ms-vscode-remote.remote-wsl
msjsdiag.debugger-for-chrome
naco-siren.gradle-language
naumovs.color-highlight
notZaki.pandocciter
NuclleaR.vscode-extension-auto-import
pflannery.vscode-versionlens
phr0s.bib
PKief.material-icon-theme
richardwillis.vscode-gradle
richie5um2.vscode-sort-json
ritwickdey.LiveServer
s-nlf-fh.glassit
sburg.vscode-javascript-booster
Shan.code-settings-sync
stevencl.addDocComments
stkb.rewrap
stylelint.vscode-stylelint
tomoki1207.pdf
usernamehw.errorlens
vilicvane.sensitive-replace
VisualStudioExptTeam.vscodeintellicode
Vtrois.gitmoji-vscode
WallabyJs.quokka-vscode
she11sh0cked commented 4 years ago

I went through and checked every extension in my list. The following extensions resulted in vscode-kotlin not working:

bleper-shoprunner commented 4 years ago

I can confirm that the vscode-gradle extension collides with this one. Looks like we can either have Gradle, or Kotlin. :)

she11sh0cked commented 4 years ago

I also have a problem of code beeing duplicated when formatting

code duplication

zrno commented 4 years ago

any movement here? Is the gradle extension creator aware of this issue?

she11sh0cked commented 4 years ago

I switched to developing kotlin under a wsl / ubuntu setup. The extensions works (mostly) as expected under these conditions. Last time i checked the the code duplication and gradle issues were no more, but dependencies weren't resolved.

danii commented 1 year ago

After reading through the comments of this issue, I almost believed I'd have to completely reinstall VSCode. Fortunately, after reading through the console in VSCode's developer tools, I noticed logs stating something along the lines of "Debugger disabled because kotlin.debugAdapter.enabled was set to false". I went to my settings.json to investigate. Sure enough, it was set to false, but right above it, kotlin.languageServer.enabled was also set to false!

image

So, I set both to true. Immediately after enabling, it instantly kicked into action, even with richardwillis.vscode-gradle installed. Thinking back, I think I did skip over some initial prompts the extension gave me. Although it is very weird it would have set it to false over just skipping some introductory notification. So, before reinstalling and scrapping all your VSCode configs, try changing that setting to true. :)

lorenzoparas commented 1 year ago

+1 for @danii's solution!