vscode code navigation âFailed to get sources.â


up vote
0
down vote
favorite
I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.
Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.
However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.
/* HashMap.class */
// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
package java.util;
public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
// many declartions for methods below
...
What I need is navigating to the HashMap.java rather than HashMap.class.
I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below
"java.classPath": ,
// Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
"java.home": null,
// Installation directory of Java 8
"java.home": "",
// Traces the communication between VS Code and the Java language server.
"java.trace.server": "off",
More info:
OS: Ubuntu 18.04 LTS
VSCODE version: 1.22.2
openjdk version "1.8.0_162"
Any help will be appreciated! Thank yoU!
java visual-studio-code
add a comment |Â
up vote
0
down vote
favorite
I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.
Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.
However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.
/* HashMap.class */
// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
package java.util;
public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
// many declartions for methods below
...
What I need is navigating to the HashMap.java rather than HashMap.class.
I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below
"java.classPath": ,
// Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
"java.home": null,
// Installation directory of Java 8
"java.home": "",
// Traces the communication between VS Code and the Java language server.
"java.trace.server": "off",
More info:
OS: Ubuntu 18.04 LTS
VSCODE version: 1.22.2
openjdk version "1.8.0_162"
Any help will be appreciated! Thank yoU!
java visual-studio-code
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.
Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.
However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.
/* HashMap.class */
// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
package java.util;
public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
// many declartions for methods below
...
What I need is navigating to the HashMap.java rather than HashMap.class.
I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below
"java.classPath": ,
// Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
"java.home": null,
// Installation directory of Java 8
"java.home": "",
// Traces the communication between VS Code and the Java language server.
"java.trace.server": "off",
More info:
OS: Ubuntu 18.04 LTS
VSCODE version: 1.22.2
openjdk version "1.8.0_162"
Any help will be appreciated! Thank yoU!
java visual-studio-code
I am using VSCODE to develop codes in Java with "Java Extension Pack". I encountered the issue that the code navigation of vscode doesn't work as expected.
Previously, I can use "Ctrl+Click"(please see the description: https://code.visualstudio.com/docs/editor/editingevolved) to check the definitions from Java packages, such as java.util.HashMap etc.
However, after re-install my OS, the code navigation didn't work as expected. Unlike some posts online(please see https://github.com/Microsoft/vscode-go/issues/966 or https://github.com/Microsoft/vscode-cpptools/issues/756), in my case, it works but it shows .class file with such comments on the top of the file. Let me use the Hashmap as the example.
/* HashMap.class */
// Failed to get sources. Instead, stub sources have been generated by the disassembler.
// Implementation of methods is unavailable.
package java.util;
public class HashMap<K,V> extends java.util.AbstractMap implements java.util.Map, java.lang.Cloneable, java.io.Serializable
// many declartions for methods below
...
What I need is navigating to the HashMap.java rather than HashMap.class.
I use "Setting Sync" extension which restores all my previous settings, so I don't think there are any issues about my setting. I still will provide some related User settings below
"java.classPath": ,
// Specifies the folder path to the JDK (8 or more recent) used to launch the Java Language Server.
"java.home": null,
// Installation directory of Java 8
"java.home": "",
// Traces the communication between VS Code and the Java language server.
"java.trace.server": "off",
More info:
OS: Ubuntu 18.04 LTS
VSCODE version: 1.22.2
openjdk version "1.8.0_162"
Any help will be appreciated! Thank yoU!
java visual-studio-code
asked Apr 26 at 23:52
Xin Chen
153
153
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I had the same error, except with a source jar in my local repository rather than HashMap.
I fixed it by quitting Visual Studio Code, removing all the .classpath
, .factorypath
, and .project
files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.
There's likely a more elegant way to do this but brute force worked.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I had the same error, except with a source jar in my local repository rather than HashMap.
I fixed it by quitting Visual Studio Code, removing all the .classpath
, .factorypath
, and .project
files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.
There's likely a more elegant way to do this but brute force worked.
add a comment |Â
up vote
0
down vote
I had the same error, except with a source jar in my local repository rather than HashMap.
I fixed it by quitting Visual Studio Code, removing all the .classpath
, .factorypath
, and .project
files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.
There's likely a more elegant way to do this but brute force worked.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I had the same error, except with a source jar in my local repository rather than HashMap.
I fixed it by quitting Visual Studio Code, removing all the .classpath
, .factorypath
, and .project
files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.
There's likely a more elegant way to do this but brute force worked.
I had the same error, except with a source jar in my local repository rather than HashMap.
I fixed it by quitting Visual Studio Code, removing all the .classpath
, .factorypath
, and .project
files (my project has submodules so there are multiple of these), then reopening VS Code and letting it find everything again.
There's likely a more elegant way to do this but brute force worked.
answered Jun 21 at 20:35


Nathan Walther
1
1
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028571%2fvscode-code-navigation-failed-to-get-sources%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password