Closed lhstrh closed 1 year ago
I found this issue and maybe add a little something here:
I use the following setup to debug the language server and the lf vscode extension and the klighd-vscode extension locally.
I use the following run config for Intellij to start the LS on its designated socket:
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="LanguageDiagramServer" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.lflang.diagram.lsp.LanguageDiagramServer" />
<module name="lingua-franca-intellij.org.lflang.main" />
<option name="VM_PARAMETERS" value="-Dport=7670 -Djava.awt.headless=true" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.lflang.diagram.lsp.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
I am not that familiar with Intellij but something like this worked for me.
The two VS Code extension repositories are next to each other.
In your workflow you seem to install the lf extension into your running development VS Code, which is quite odd.
I suggest adding a new launch configuration to start a second VS Code:
{
"name": "Launch VS Code Extension (Socket) LF",
"type": "pwa-extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/../klighd-vscode/applications/klighd-vscode",
"--extensionDevelopmentPath=${workspaceFolder}/",
],
"env": {
"LF_LS_PORT": "7670"
},
"skipFiles": [
"<node_internals>/**"
],
"sourceMaps": true,
"smartStep": true,
"sourceMapPathOverrides": {
"webpack:///./~/*": "${workspaceFolder}/../klighd-vscode/node_modules/*",
"webpack://?:*/*": "${workspaceFolder}/../klighd-vscode/applications/klighd-vscode/*"
},
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/../klighd-vscode/applications/klighd-vscode/dist/**/*.js"
],
},
I added the path to the klighd-vscode extension (which should not be in here, if you do not want to run it locally but it might help identifying problems with it). I disable other extensions installed to make sure they do not interfere. This might for example be the case for the KIELER VS Code extension for SCCharts. Since I use two extensions I need to override the source maps as shown here for the klighd-vscode extension to debug all code that does not run in a webview. Webview code can only be debugged via the developer tools in the second VS Code. The outfiles should again reference the .js files of both extensions.
This way I can debug the language server and do not need to build and package it into a jar.
If you have more questions feel free to ask.
The IntelliJ configuration did not work for me, but by setting -Dport=7670
using the directions here for the community version of IntelliJ, I was able to get this to work.
See: https://github.com/lf-lang/lingua-franca/discussions/1095