Skip to content

Commit e360195

Browse files
committed
fix: remove deprecated url.parse
1 parent 9483efc commit e360195

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/convert.ts

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

65
/**
@@ -31,12 +30,12 @@ export default class Convert {
3130
* to deal with http/https sources in the future.
3231
*/
3332
public static uriToPath(uri: string): string {
34-
const url = URL.parse(uri) /*eslint node/no-deprecated-api: "warn"*/ // TODO
35-
if (url.protocol !== "file:" || url.path === undefined || url.path === null) {
33+
const url = new URL(uri, "file://")
34+
if (url.protocol !== "file:" || url.pathname == null) {
3635
return uri
3736
}
3837

39-
let filePath = decodeURIComponent(url.path)
38+
let filePath = decodeURIComponent(url.pathname)
4039
if (process.platform === "win32") {
4140
// Deal with Windows drive names
4241
if (filePath[0] === "/") {

0 commit comments

Comments
 (0)