|
@@ -1,4 +1,5 @@
|
|
|
import type { BoxRenderable, TextareaRenderable, KeyEvent, ScrollBoxRenderable } from "@opentui/core"
|
|
import type { BoxRenderable, TextareaRenderable, KeyEvent, ScrollBoxRenderable } from "@opentui/core"
|
|
|
|
|
+import { pathToFileURL } from "bun"
|
|
|
import fuzzysort from "fuzzysort"
|
|
import fuzzysort from "fuzzysort"
|
|
|
import { firstBy } from "remeda"
|
|
import { firstBy } from "remeda"
|
|
|
import { createMemo, createResource, createEffect, onMount, onCleanup, Index, Show, createSignal } from "solid-js"
|
|
import { createMemo, createResource, createEffect, onMount, onCleanup, Index, Show, createSignal } from "solid-js"
|
|
@@ -246,17 +247,17 @@ export function Autocomplete(props: {
|
|
|
const width = props.anchor().width - 4
|
|
const width = props.anchor().width - 4
|
|
|
options.push(
|
|
options.push(
|
|
|
...sortedFiles.map((item): AutocompleteOption => {
|
|
...sortedFiles.map((item): AutocompleteOption => {
|
|
|
- let url = `file://${process.cwd()}/${item}`
|
|
|
|
|
|
|
+ const fullPath = `${process.cwd()}/${item}`
|
|
|
|
|
+ const urlObj = pathToFileURL(fullPath)
|
|
|
let filename = item
|
|
let filename = item
|
|
|
if (lineRange && !item.endsWith("/")) {
|
|
if (lineRange && !item.endsWith("/")) {
|
|
|
filename = `${item}#${lineRange.startLine}${lineRange.endLine ? `-${lineRange.endLine}` : ""}`
|
|
filename = `${item}#${lineRange.startLine}${lineRange.endLine ? `-${lineRange.endLine}` : ""}`
|
|
|
- const urlObj = new URL(url)
|
|
|
|
|
urlObj.searchParams.set("start", String(lineRange.startLine))
|
|
urlObj.searchParams.set("start", String(lineRange.startLine))
|
|
|
if (lineRange.endLine !== undefined) {
|
|
if (lineRange.endLine !== undefined) {
|
|
|
urlObj.searchParams.set("end", String(lineRange.endLine))
|
|
urlObj.searchParams.set("end", String(lineRange.endLine))
|
|
|
}
|
|
}
|
|
|
- url = urlObj.toString()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ const url = urlObj.href
|
|
|
|
|
|
|
|
const isDir = item.endsWith("/")
|
|
const isDir = item.endsWith("/")
|
|
|
return {
|
|
return {
|