現象
用vscode寫java代碼的時候突然出現,修復問題點擊Ctrl時,輸出窗口就打日志,報錯Request textDocument/definition failed。
我百度唯一的有用線索就是這個報錯有一個關於js的報錯也是輸出的Request textDocument/definition failed。
有一個回答就是說"這是一個bug,等待解決"。Spring Boot Tools當前的版本是1.8.0.我回退到1.7.0,成功了
錯誤
[Error - 下午8:28:20] Request textDocument/definition failed.
Error: The received response has neither a result nor an error property.
at handleInvalidMessage (C:\**省略*\.vscode\extensions\pivotal.vscode-spring-boot-1.8.0\node_modules\vscode-jsonrpc\lib\main.js:517:40)
at processMessageQueue (C:\**省略*\.\.vscode\extensions\pivotal.vscode-spring-boot-1.8.0\node_modules\vscode-jsonrpc\lib\main.js:266:17)
at Immediate.setImmediate (C:\**省略*\.0\.vscode\extensions\pivotal.vscode-spring-boot-1.8.0\node_modules\vscode-jsonrpc\lib\main.js:247:13)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
解決方式
我嘗試回退Spring Boot Tools至1.7.0,問題解決了。
我再次升級版本值1.8.0問題浮現
更新日志
## 2019-06-21 (4.3.0 RELEASE)
* *(Spring Boot)* improvement: project classpath notifications now happen in batch on startup to further optimize performance and job load on the Eclipse side
* *(Spring Boot)* improvement: symbols are now being re-created if dependent types change
* *(Spring Boot)* fixed: Slow code completion takes more than a 1 sec. ([#293](https://github.com/spring-projects/sts4/issues/293 "https://github.com/spring-projects/sts4/issues/293"))
* *(Spring Boot)* fixed: content-assist for Spring XML config files now working again in VS Code and Theia
* *(Spring Boot)* fixed: ClassCast Exception in Boot LS while application.yml file opened in the editor
* *(Spring Boot)* fixed: Anonymous inner type beans don't have boot hints
## 2019-05-24 (4.2.2 RELEASE)
* *(all language servers)* performance: additional improvements to language server startup time
* *(Spring Boot)* new: additional fine-grained preferences for Spring XML config file support
* *(Spring Boot)* new: navigation for bean identifiers, bean classes, and property names for Spring XML config files
* *(Spring Boot)* new: content-assist rolled out for many more Spring XML config elements and attributes
* *(Spring Boot)* new: live bean information now showing up in types from class files (when source code is shown) - *VSCode and Theia only at the moment*
* *(Spring Boot)* improvement: hugely improved content-assist for bean class attribute in Spring XML config files (incl. package name proposals and vastly improved performance)
* *(Spring Boot)* improvement: property name content-assist in Spring XML config files now shows proposals from properties defined in supertypes, too
* *(Spring Boot)* improvement: symbol scanning skips output folders now
結語
對於官方的版本也出現這樣的bug,我覺得開源也不是良葯,有的時候會在生產和工作中帶來負面后果。穩定反而更迫切!