Skip to content

Commit

Permalink
Add ts-plugin to diagnostic sources (#103)
Browse files Browse the repository at this point in the history
* Try to fix Casing issue in uri.path between formatted diagnostics and hoverProvider #100

* Add ts-plugin diagnostic source for Vue Hybrid mode

* Bump version
  • Loading branch information
yoavbls committed Apr 7, 2024
1 parent 29eb7d9 commit 2531440
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
12 changes: 12 additions & 0 deletions examples/errors.vue
@@ -0,0 +1,12 @@
<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>
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"displayName": "Pretty TypeScript Errors",
"publisher": "YoavBls",
"description": "Make TypeScript errors prettier and more human-readable in VSCode",
"version": "0.5.3",
"version": "0.5.4",
"icon": "assets/icon.png",
"repository": {
"type": "git",
Expand Down
7 changes: 5 additions & 2 deletions src/extension.ts
Expand Up @@ -36,7 +36,10 @@ export function activate(context: ExtensionContext) {
diagnostics
.filter((diagnostic) =>
diagnostic.source
? has(["ts", "deno-ts", "js", "glint"], diagnostic.source)
? has(
["ts", "ts-plugin", "deno-ts", "js", "glint"],
diagnostic.source
)
: false
)
.forEach(async (diagnostic) => {
Expand Down Expand Up @@ -69,7 +72,7 @@ export function activate(context: ExtensionContext) {
hasTsDiagnostic = true;
});

uriStore[uri.path] = items;
uriStore[uri.fsPath] = items;

if (hasTsDiagnostic) {
const editor = window.visibleTextEditors.find(
Expand Down
2 changes: 1 addition & 1 deletion src/format/embedSymbolLinks.ts
Expand Up @@ -18,7 +18,7 @@ export function embedSymbolLinks(diagnostic: Diagnostic): Diagnostic {
...diagnostic,
message: diagnostic.message.replaceAll(
symbol,
`${symbol} <a href="${URI.parse(ref.location.uri).path}#${
`${symbol} <a href="${URI.parse(ref.location.uri).fsPath}#${
ref.location.range.start.line + 1
},${
ref.location.range.start.character + 1
Expand Down
2 changes: 1 addition & 1 deletion src/provider/hoverProvider.ts
Expand Up @@ -3,7 +3,7 @@ import { uriStore } from "./uriStore";

export const hoverProvider: HoverProvider = {
provideHover(document, position) {
const itemsInUriStore = uriStore[document.uri.path];
const itemsInUriStore = uriStore[document.uri.fsPath];

if (!itemsInUriStore) {
return null;
Expand Down

0 comments on commit 2531440

Please sign in to comment.