Repository: autozimu/LanguageClient-neovim (language: rust)

Issue:
Resolving jdt URLs inside jdt buffers
## Summary

Navigating from a `.java` to a `jdt://*` URL works, but opening another `jdt://*` reference inside an `jdt://*` buffer fails:

```
Error: ErrorMessage { msg: "Failed to convert from path (\"jdt://contents/rt.jar/java.lang/System.class?=sample-java/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk1.8.0_92.jdk%5C/Contents%5C/Home%5C/jre%5C/lib%5C/rt.jar%3Cjava.lang(System.class\") to Url" }
```  

## Reproduction
- neovim/vim version: v0.3.1-9-gf27a665e0
- This plugin version: 9a316ef
- This plugin's binary version: 0.1.88 9a316ef9f044674724b44cd162f3996113ea4861
- Language server link and version: [eclipse.jdt.ls](https://github.com/eclipse/eclipse.jdt.ls)
- Steps to reproduce the issue from clean state
    1. Open [App.java](https://github.com/autozimu/LanguageClient-neovim/blob/next/tests/data/sample-java/src/main/java/app/App.java)
    2. Jump to definition of System.__out__ (Line 11)
    3. Jump to another definition (e.g. `PrintStream`)
- Logs:
[LanguageClient.log](https://github.com/autozimu/LanguageClient-neovim/files/2108916/LanguageClient.log)

## Current Behavior

Jump to definition via `*.java` -> `jdt://*` -> `jdt://*` fails

## Expected Behavior

Jump to definition via `*.java` -> `jdt://*` -> `jdt://*` works


Discussion / hints:
It seems cannot be reproduced from the given steps.

Anyway, jumping a second time from a "jdt://*" buffer shouldn't''t be supported in the first place as the filetype is not java anymore.
@autozimu I reproduced the issue with a minimal configuration and recorded it:

![ezgif-2-fd5bcba842](https://user-images.githubusercontent.com/264745/41711272-0badda4c-7548-11e8-8f4c-9aecee94c66a.gif)

This is the minimal config:

```php
call plug#begin('~/.nvim/plugged')
Plug 'autozimu/LanguageClient-neovim', { 
    \ 'branch': 'next',
    \ 'do': 'bash install.sh'
    \}
call plug#end()

syntax enable

let g:LanguageClient_serverCommands = {
    \ 'java': ['javalsp'],
\ }

let g:LanguageClient_windowLogMessageLevel = 'Error'
let g:LanguageClient_loggingFile = '/Users/tbo/logs/LanguageClient.log'
let g:LanguageClient_loggingLevel = 'DEBUG'
let g:LanguageClient_autoStart = 1
```

> Anyway, jumping a second time from a "jdt://*" buffer shouldn't''t be supported in the first place as the filetype is not java anymore.

1. As you can the see in the screencast the filetype still returns `java`
2. Other LSP Clients like Visual Studio Code and Eclipse Che support this
3. It is essential for Java development
4. What is the difference to Typescript language servers that resolve files in `node_modules`? I know, that `node_modules` keeps the files in the filesystem and Java chose to put them into jars. But from a developer perspective I'm simply resolving Java definitions.

Fix patch:
diff --git a/src/utils.rs b/src/utils.rs
index 5d4da5c5e..5a018387b 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -120,12 +120,14 @@ pub trait ToUrl {
 
 impl<P: AsRef<Path> + std::fmt::Debug> ToUrl for P {
     fn to_url(&self) -> Result<Url> {
-        Url::from_file_path(self).or_else(|_| {
-            Err(format_err!(
-                "Failed to convert from path ({:?}) to Url",
-                self
-            ))
-        })
+        Url::from_file_path(self).or_else(|_| (
+            Url::from_str(&self.as_ref().to_string_lossy()).or_else(|_| {
+                Err(format_err!(
+                        "Failed to convert from path ({:?}) to Url",
+                        self
+                ))
+            })
+        ))
     }
 }
 


Test patch: