Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Cannot save Java-files when languageserver is running #115

Closed
1 task done
mdiin opened this issue Jan 20, 2020 · 12 comments · Fixed by #116
Closed
1 task done

Cannot save Java-files when languageserver is running #115

mdiin opened this issue Jan 20, 2020 · 12 comments · Fixed by #116

Comments

@mdiin
Copy link
Contributor

mdiin commented Jan 20, 2020

Prerequisites

Description

After the Java language server has started, attempting to save Java-files results in an error.

Steps to Reproduce

  1. Open any Java file
  2. Wait for languageserver to be running
  3. Save file

Expected behavior:

I would expect the file to be saved.

Actual behavior:

In the UI, nothing happens.

In the developer console, this error is visible:

Uncaught (in promise) TypeError: Cannot read property 'Manual' of undefined
    at TextEditorSyncAdapter.willSave (document-sync-adapter.ts:331)
    at Function.simpleDispatch (/usr/lib/atom/node_modules/event-kit/dist/emitter.js:64)
    at /usr/lib/atom/node_modules/event-kit/dist/emitter.js:270
    at Array.map (<anonymous>)
    at Emitter.emitAsync (/usr/lib/atom/node_modules/event-kit/dist/emitter.js:269)
    at TextBuffer.saveTo (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1923)
willSave @ document-sync-adapter.ts:331
simpleDispatch @ /usr/lib/atom/node_modules/event-kit/dist/emitter.js:64
(anonymous) @ /usr/lib/atom/node_modules/event-kit/dist/emitter.js:270
emitAsync @ /usr/lib/atom/node_modules/event-kit/dist/emitter.js:269
saveTo @ /usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1923

Reproduces how often:

Every time.

Versions

atom --version:
Atom : 1.42.0
Electron: 4.2.12
Chrome : 69.0.3497.128
Node : 10.11.0

apm --version:
apm 2.4.5
npm 6.13.6
node 13.6.0 x64
atom 1.42.0
python 3.8.1
git 2.25.0

OS:
ArchLinux, kernel 5.4.10-arch1-1

Additional Information

This was working last week, yet nothing on my atom install or OS has been updated since then. I have tried full reinstall, including reset of ~/.atom, to no effect.

I think this is the proper project for this issue, since this is the project that includes the vscode-languageserver-protocol package, but it might not be?

@mdiin
Copy link
Contributor Author

mdiin commented Jan 20, 2020

Bumping the vscode-languageclient dependencies in the atom-languageclient node_module and running npm install inside that dependency's folder has "solved" the issue. After that, I tried bumping the atom-languageclient dependency of this project to 0.9.9. This also solved the issue (by transitive dependencies), which means that is probably the correct solution.

I still wonder why this happened though...

@mdiin
Copy link
Contributor Author

mdiin commented Jan 22, 2020 via email

@rajivshah3
Copy link
Contributor

Thanks @mdiin, I was running into this issue as well! I created a PR with the fix: #116

If anyone wants to apply this fix without needing to manually edit the package.json, follow these steps:

  1. Find ide-java in the Packages section of Atom settings and uninstall it
  2. Open Terminal and run apm install https://github.com/rajivshah3/ide-java
  3. Restart Atom

@grindarius
Copy link

Thanks @mdiin, I was running into this issue as well! I created a PR with the fix: #116

If anyone wants to apply this fix without needing to manually edit the package.json, follow these steps:

1. Find `ide-java` in the Packages section of Atom settings and uninstall it

2. Open Terminal and run `apm install https://github.com/rajivshah3/ide-java`

3. Restart Atom

So I tried your solution but when I run "apm install https://github.com/rajivshah3/ide-java"
It says
Cloning https://github.com/rajivshah3/ide-java.git failed Installing modules done Cannot read property 'getReferenceTarget' of null

and I don't quite get it why it doesn't work

@Tripp-Sautner
Copy link

Its probably cause @rajivshah3 uses a mac while Windows users might have to utilize a different way of getting around the issue, we need to add this directly to our path via System Variables though this PC system.

image

"%USERPROFILE%\AppData\Local\atom\bin" <---- That

@Tripp-Sautner
Copy link

Tripp-Sautner commented Jan 27, 2020

It might already be in your path @grindarius so it might be just a java error within this package and maybe there are traces of a previous installation of the package causing issues

@rajivshah3
Copy link
Contributor

rajivshah3 commented Jan 28, 2020 via email

@grindarius
Copy link

Its probably cause @rajivshah3 uses a mac while Windows users might have to utilize a different way of getting around the issue, we need to add this directly to our path via System Variables though this PC system.

image

"%USERPROFILE%\AppData\Local\atom\bin" <---- That

I tried your method and still get the same error out of it. Maybe I need a fresh Windows installation?

@ytxmobile98
Copy link

I don’t know if you got it working, but let me give you some more detailed steps. This assumes you are on a Linux OS. 1. ‘cd ~/.atom/packages/ide-java’ 2. Open ‘packages.json’ 3. Under the ‘dependencies’ key, find the line which says ‘atom-language client’ and up the version to ‘0.9.9’ 4. Run ‘npm install’ Now the Java IDE should use the newer dependency, and saving files should work again. I hope this helps. Matthias Varberg Ingesman

Den 22. jan. 2020 kl. 04.37 skrev Marcelo Laser @.***>:  I am also having this issue but am not competent enough to apply any of what mdiin described as a solution. I would appreciate any help, as this has effectively made ide-java unusable for the time being. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

This fixed my issue as well.

@turneps403
Copy link

I met with this problem on macOS
atom --version
Atom : 1.45.0
Electron: 4.2.7
Chrome : 69.0.3497.128
Node : 10.11.0

And after the update node version to last 13.12.0 problem was solved.
So, in my case brew upgrade node resolved the problem

@howlettga
Copy link

I can't save any files when java-ide is installed as an extension for atom. i tried updating the dependency to 0.9.9 without success. I have node.js 12.x installed as I have to run the LTS version. Is node LTS not supported for ide-java? Running on Windows 10

@marchingon12 marchingon12 mentioned this issue Oct 6, 2020
1 task
@ParadoxV5
Copy link

When will the PR for this severe bug release?

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

Successfully merging a pull request may close this issue.

8 participants