Skip to content

Commit eba942d

Browse files
committed
chore: fix url.parse deprecation
1 parent 89fa90a commit eba942d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/convert.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type * as atomIde from "atom-ide-base"
22
import * as ls from "./languageclient"
3-
import * as URL from "url"
3+
import { URL } from "url"
44
import { Point, FilesystemChange, Range, TextEditor } from "atom"
55

66
/**
@@ -31,12 +31,13 @@ export default class Convert {
3131
* to deal with http/https sources in the future.
3232
*/
3333
public static uriToPath(uri: string): string {
34-
const url = URL.parse(uri)
35-
if (url.protocol !== "file:" || url.path === undefined || url.path === null) {
34+
const url = new URL(uri)
35+
const urlPath = url.pathname + url.search
36+
if (url.protocol !== "file:" || urlPath === undefined || urlPath === null) {
3637
return uri
3738
}
3839

39-
let filePath = decodeURIComponent(url.path)
40+
let filePath = decodeURIComponent(urlPath)
4041
if (process.platform === "win32") {
4142
// Deal with Windows drive names
4243
if (filePath[0] === "/") {

0 commit comments

Comments
 (0)