Describe the bug
I noticed that I did not get any prettified errors when working from a .vue
file.
I setup a basic snippet like:
<script setup lang="ts">
import { RouterView } from 'vue-router';
const x = [1, 2, 3, '4'];
function y(param: number[]) {
}
y(x);
</script>
<template>
<RouterView />
</template>
And per screenshot the highlighter result:
Expected behavior
I expected to see a prettified error message as vue support is implemented.
Cause
I cloned the repo and ran it with the debugger and found that this issue is caused by the following:
|
uriStore[uri.path] = items; |
On this line the value of uri.path
is: '/c:/Users/kevin/Documents/Projects/phavuer-playground/src/App.vue'
When in the hoverProvider.ts
:
|
const itemsInUriStore = uriStore[document.uri.path]; |
|
|
|
if (!itemsInUriStore) { |
|
return null; |
|
} |
The value of document.uri.path
is '/C:/Users/kevin/Documents/Projects/phavuer-playground/src/App.vue'
.
Notice the casing difference of the C
drive:
- '/c:/Users/kevin/Documents/Projects/phavuer-playground/src/App.vue'
+ '/C:/Users/kevin/Documents/Projects/phavuer-playground/src/App.vue'
This causes the hoverProvider
to think there are no stored items to show, and thus show no results.
Fix
VS Code seems to use this implementation for the Uri
class.
Maybe use fsPath
instead as it states:
/**
* Returns a string representing the corresponding file system path of this URI.
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
* platform specific path separator.
*
* * Will *not* validate the path for invalid characters and semantics.
* * Will *not* look at the scheme of this URI.
* * The result shall *not* be used for display purposes but for accessing a file on disk.
*
*
* The *difference* to `URI#path` is the use of the platform specific separator and the handling
* of UNC paths. See the below sample of a file-uri with an authority (UNC path).
*/