Skip to content

Commit

Permalink
Use URI.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 7, 2023
1 parent 1f39688 commit 48d12b8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/language-server/test/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('@volar/language-server').TextDocumentItem} TextDocumentItem
* @typedef {import('@volar/language-server').ProtocolConnection} ProtocolConnection
* @typedef {import('@volar/language-server').PublishDiagnosticsParams} PublishDiagnosticsParams
* @typedef {import('vscode-languageserver').TextDocumentItem} TextDocumentItem
* @typedef {import('vscode-languageserver').ProtocolConnection} ProtocolConnection
* @typedef {import('vscode-languageserver').PublishDiagnosticsParams} PublishDiagnosticsParams
*/

import {spawn} from 'node:child_process'
Expand All @@ -15,7 +15,7 @@ import {
IPCMessageReader,
IPCMessageWriter,
PublishDiagnosticsNotification
} from '@volar/language-server/node.js'
} from 'vscode-languageserver/node.js'
import {URI} from 'vscode-uri'
// eslint-disable-next-line import/order
import normalizePath from 'normalize-path'
Expand Down Expand Up @@ -61,9 +61,7 @@ export function createConnection() {
* @returns {string} The uri that matches the fixture file name.
*/
export function fixtureUri(fileName) {
return String(
URI.parse(String(new URL(`../../../fixtures/${fileName}`, import.meta.url)))
)
return URI.parse(String(new URL(`../../../fixtures/${fileName}`, import.meta.url))).toString()
}

/**
Expand All @@ -83,7 +81,7 @@ export function fixturePath(fileName) {
*/
export async function openTextDocument(connection, fileName) {
const url = new URL(`../../../fixtures/${fileName}`, import.meta.url)
const uri = String(URI.parse(String(url)))
const uri = URI.parse(String(url)).toString()
const text = await fs.readFile(url, 'utf8')
/** @type {TextDocumentItem} */
const textDocument = {
Expand Down

0 comments on commit 48d12b8

Please sign in to comment.