Skip to content

fortls.langserver.JSONRPC2Error. Error in using Mordern Fortran with fortls, on remote host using VScode #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
l975421700 opened this issue Jun 21, 2022 · 4 comments

Comments

@l975421700
Copy link

Dear developers

I meet a problem while using Modern Fortran v3.1.0 in VScode 1.68.0. VScode is run on MacOS, and I am using Modern Fortran on a remote linux server. The problem is that even fortls seems to be initialized successfully, I cannot use most of the functions (e.g. GoTos, Peeks). Can you please help or advise where else I should seek help? Below are detailed information about my set up. If you need more information, please let me know.

Regards, Qinggang

################################ OUTPUT from Modern Fortran in VScode
["INFO" - 4:13:01 PM] Extension Name: Modern Fortran
["INFO" - 4:13:01 PM] Extension Version: 3.1.0
["INFO" - 4:13:01 PM] Linter set to: gfortran
["INFO" - 4:13:01 PM] Formatter set to: findent
["INFO" - 4:13:01 PM] Autocomplete set to: fortls
["INFO" - 4:13:01 PM] Hover set to: fortls
["INFO" - 4:13:01 PM] Symbols set to: fortls
["INFO" - 4:13:01 PM] using linter: gfortran located in: /global/AWIsoft/gcc/8.1.0/bin/gfortran
["INFO" - 4:13:01 PM] Linter.arguments:
-Wall
-ffree-line-length-none
-ffixed-line-length-none
["INFO" - 4:13:01 PM] Linter.include:

["INFO" - 4:13:01 PM] Fortran Language Server
["INFO" - 4:13:01 PM] Initialising Language Server for workspace: /work/ollie/qigao001/model_codes/echam-6.3.05p2-wiso/src/echam/mo_cloud.f90 with command-line options: --enable_code_actions, --hover_signature, --use_signature_help, --nthreads=4, --notify_init, --incremental_sync
[INFO - 16:14:02] fortls - Fortran Language Server 2.9.0 Initialized
[INFO - 16:14:02] fortls initialization complete
[ERRO - 16:14:02] error handling request: {'jsonrpc': '2.0', 'method': 'workspace/didChangeConfiguration', 'params': {'settings': {'fortran': {'provide': {'autocomplete': 'fortls', 'hover': 'fortls', 'symbols': 'fortls'}, 'preferredCase': 'uppercase', 'linter': {'compiler': 'gfortran', 'includePaths': [], 'compilerPath': '', 'extraArgs': [], 'modOutput': ''}, 'formatting': {'formatter': 'findent', 'findentArgs': [], 'fprettifyArgs': [], 'path': ''}, 'fortls': {'path': '/home/ollie/qigao001/.local/bin/fortls', 'configure': '', 'notifyInit': True, 'incrementalSync': True, 'nthreads': 4, 'sortKeywords': False, 'symbolTypes': True, 'suffixes': [], 'directories': [], 'excludeSuffixes': [], 'excludeDirectories': [], 'preprocessor': {'suffixes': [], 'directories': [], 'definitions': {}}, 'disableDiagnostics': False, 'maxLineLength': -1, 'maxCommentLineLength': -1, 'extraArgs': [], 'disableAutoupdate': False, 'disabled': False, 'preserveKeywordOrder': None}, 'includePaths': None, 'gfortranExecutable': None, 'linterEnabled': None, 'linterExtraArgs': None, 'linterModOutput': None, 'provideSymbols': None, 'symbols': None, 'provideHover': None, 'provideCompletion': None}}}}
Traceback (most recent call last):
File "/home/ollie/qigao001/.local/lib/python3.7/site-packages/fortls/langserver.py", line 160, in handle
handler(request)
File "/home/ollie/qigao001/.local/lib/python3.7/site-packages/fortls/langserver.py", line 1488, in serve_default
code=-32601, message=f"method {request['method']} not found"
fortls.langserver.JSONRPC2Error

################################ Info about fortls
$ which fortls
~/.local/bin/fortls
$ fortls --version
2.9.0

I installed fortls with pip before I installed Modern Fortran. I also tried to let Modern Fortran install fortls for me, same errors happen.

################################ Info about VSCode
Version: 1.68.0 (Universal)
Commit: 4af164ea3a06f701fe3e89a2bcbb421d2026b68f
Date: 2022-06-08T11:44:00.250Z (1 wk ago)
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.5.0

################################ Info about Mac OS:
macOS Monterey
Version 12.4
Chip Apple M1 Pro

################################ Info about Linux remote server:

uname -a
Linux ollie0 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

And I do not have 'sudo' permission.

################################ VScode settings:
{
"workbench.startupEditor": "newUntitledFile",
"python.dataScience.alwaysTrustNotebooks": true,
"explorer.confirmDelete": false,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.languageServer": "Pylance",
"remoteX11.SSH.privateKey": "~/.ssh/id_ed25519",
"remoteX11.SSH.timeout": 30,
"remoteX11.SSH.verboseLogging": true,
"remoteX11.SSH.port": 22,
"explorer.confirmDragAndDrop": false,
"editor.rulers": [
79
],
"kite.showWelcomeNotificationOnStartup": false,
"extensions.ignoreRecommendations": false,
"python.terminal.launchArgs": [
"-c",
""from IPython import start_ipython; start_ipython()"",
"--no-autoindent",
],
"debug.showBreakpointsInOverviewRuler": true,
"remote.SSH.remotePlatform": {
"daint": "linux",
"fog": "linux",
"daint1": "linux",
"fog.ethz.ch": "linux",
"ela": "linux",
"daint2": "linux",
"ivt": "linux",
"jasmin": "linux",
"sci3": "linux",
"sci8": "linux",
"ollie": "linux"
},
"remote.SSH.connectTimeout": 60,
"remote.SSH.useFlock": false,
"files.exclude": {
"/.*": true,
"
/.gitignore": true,
"/.hg": false,
"
/.svn": false,
"/.vscode": true,
"
/bas_palaeoclim": true,
"/bilinear*.nc": true,
"
/cfview": true,
"/CVS": false,
"
/dask-worker-space": true,
"/LICENSE": true,
"
/MetOffice_data_licence.1275844907": true,
"**/miniconda3": true
},
"remote.SSH.remoteServerListenOnSocket": true,
"git.ignoreLegacyWarning": true,
"gitlens.advanced.messages": {
"suppressGitVersionWarning": true
},
"files.associations": {
".rmd": "markdown"
},
"r.bracketedPaste": true,
"r.editor.tabSize": 4,
"r.linting.doubleQuotes": false,
"r.linting.enable": true,
"r.linting.maxLineLength": 79,
"r.dependencyChecks": false,
"editor.largeFileOptimizations": false,
"workbench.activityBar.iconClickBehavior": "focus",
"timeline.excludeSources": [
"git-history"
],
"editor.minimap.enabled": false,
"python.showStartPage": false,
"r.rterm.linux": "/nas/qigao/miniconda3/envs/mobis/bin/radian",
"r.sessionWatcher": true,
"workbench.colorTheme": "Quiet Light",
"settingsSync.ignoredSettings": [
"editor.fontSize",
"debug.console.fontSize",
"markdown.preview.fontSize",
"terminal.integrated.fontSize",
"jupyter.notebookFileRoot",
"fortran.gfortranExecutable",
"editor.wordWrap"
],
"workbench.editorAssociations": {
"
.ipynb": "jupyter-notebook"
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"gitlens.codeLens.scopes": [
"document"
]
},
"editor.fontSize": 18,
"workbench.editor.untitled.hint": "hidden",
"debug.console.fontSize": 18,
"markdown.preview.fontSize": 18,
"update.mode": "none",
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"security.workspace.trust.untrustedFiles": "open",
"[python]": {
"editor.wordBasedSuggestions": false
},
"terminal.integrated.defaultProfile.osx": "bash",
"python.autoComplete.extraPaths": [
"/home/users/qino",
],
"python.analysis.extraPaths": [
"/home/users/qino"
],
"jupyter.askForKernelRestart": false,
"editor.hover.enabled": false,
"terminal.integrated.fontSize": 14,
"scm.inputFontSize": 18,
"notebook.markup.fontSize": 18,
"explorer.autoReveal": false,
"editor.foldingMaximumRegions": 65000,
"editor.wrappingIndent": "indent",
"git.ignoreLimitWarning": true,
"jupyter.magicCommandsAsComments": true,
"terminal.integrated.inheritEnv": false,
"extensions.autoUpdate": false,
"terminal.integrated.scrollback": 100000,
"terminal.integrated.persistentSessionScrollback": 100000,
"files.maxMemoryForLargeFilesMB": 12288,
"editor.accessibilitySupport": "off",
"window.zoomLevel": -1,
"fortran.preferredCase": "uppercase",
"fortran.fortls.path": "/home/ollie/qigao001/.local/bin/fortls",
"editor.wordWrap": "wordWrapColumn",
"fortran.fortls.notifyInit": true,
}

@gnikit
Copy link
Member

gnikit commented Jun 21, 2022

From the settings you have posted it is not clear if those are your local or remote VS Code settings. I will assume that they are from your remote Linux machine. The JSONRPC error that you are seeing is not important and does not affect the fortls functionality so you can ignore that.

Other than some outdated options in Modern Fortran, I can't see anything wrong with your configuration and logs. Can you provide a Minimal Working Example to reproduce fortls's GoTos not working?

For future reference if you are seeking assistance please start a Q&A Discussion rather than using the Other issue template.

@l975421700
Copy link
Author

Thanks for the swift reply. That's my remote VS Code settings.

While I was making a minimal working example, I found that installing fortls first and then installing Modern Fortran does solve my problem. It seems just takes a bit longer to work on a big model I am working on. So I will close this issue, sorry for any confusion caused.

@gnikit
Copy link
Member

gnikit commented Jun 21, 2022

fortls when installed via pip from VS Code should also work, because the installation process waits for pip to finish before calling fortls. In general fortls even when using the 4 threads (by default) can take a few seconds to initialise in big projects. Also if you are having problems with fortls or settings you passed to fortls are not getting updated you can always restart it from the command palette (Cmd + Shift + P, and start typing "Fortran: Restart the Fortran Language Server")

@l975421700
Copy link
Author

Thanks very much. That's good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants