File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export * from './lib/clean-path';
33export * from './lib/completion-trigger-characters.interface' ;
44export * from './lib/dot-idl-folder.interface' ;
55export * from './lib/envi-opener.interface' ;
6+ export * from './lib/get-canonical-path' ;
67export * from './lib/get-extension-path' ;
78export * from './lib/get-fs-path' ;
89export * from './lib/idl-commands.interface' ;
Original file line number Diff line number Diff line change 1+ import { existsSync , realpathSync } from 'fs' ;
2+
3+ /**
4+ * Gets the canonical path for a file
5+ *
6+ * Handles special logic with "realpathSync" that needs to
7+ * have a file that exists on disk.
8+ */
9+ export function GetCanonicalPath ( fsPath : string ) {
10+ return existsSync ( fsPath ) ? realpathSync ( fsPath ) : fsPath ;
11+ }
Original file line number Diff line number Diff line change 1- import { realpathSync } from 'fs' ;
21import { URI } from 'vscode-uri' ;
32
43import { CleanPath } from './clean-path' ;
4+ import { GetCanonicalPath } from './get-canonical-path' ;
55
66/**
77 * Parses a VSCode URI and returns the fully-qualified filepath on disk.
88 *
99 * Resolves symbolic links to get true paths on disk.
1010 */
1111export function GetFSPath ( uri : string ) {
12- return realpathSync ( CleanPath ( URI . parse ( uri ) . fsPath ) ) ;
12+ /**
13+ * Get cleaned path for fil eon disk
14+ */
15+ const cleaned = CleanPath ( URI . parse ( uri ) . fsPath ) ;
16+
17+ // return canonical path for file on disk
18+ return GetCanonicalPath ( cleaned ) ;
1319}
Original file line number Diff line number Diff line change 11import {
22 ALL_DOCUMENT_SELECTORS ,
33 CleanPath ,
4+ GetCanonicalPath ,
45 IDL_LANGUAGE_NAME ,
56 NODE_MEMORY_CONFIG ,
67 NOTIFY_FILES_GLOB_PATTERN ,
@@ -12,7 +13,7 @@ import { LANGUAGE_SERVER_MESSAGE_LOOKUP } from '@idl/vscode/events/messages';
1213import { VSCodeTelemetryLogger } from '@idl/vscode/shared' ;
1314import { execSync } from 'child_process' ;
1415import { compare } from 'compare-versions' ;
15- import { lstatSync , realpathSync } from 'fs' ;
16+ import { lstatSync } from 'fs' ;
1617import * as path from 'path' ;
1718import { ExtensionContext , workspace } from 'vscode' ;
1819import {
@@ -290,8 +291,8 @@ export async function StartLanguageServer(ctx: ExtensionContext) {
290291 {
291292 files : event . files . map ( ( item ) => {
292293 return {
293- oldUri : realpathSync ( CleanPath ( item . oldUri . fsPath ) ) ,
294- newUri : realpathSync ( CleanPath ( item . newUri . fsPath ) ) ,
294+ oldUri : GetCanonicalPath ( CleanPath ( item . oldUri . fsPath ) ) ,
295+ newUri : GetCanonicalPath ( CleanPath ( item . newUri . fsPath ) ) ,
295296 } ;
296297 } ) ,
297298 }
Original file line number Diff line number Diff line change 1- import { CleanPath , IDLFileHelper } from '@idl/shared' ;
2- import { realpathSync } from 'fs' ;
1+ import { GetFSPath , IDLFileHelper } from '@idl/shared' ;
32import { URI } from 'vscode-uri' ;
43
54import { NOTEBOOK_MANAGER } from '../events/initialize-notebook-manager' ;
@@ -25,7 +24,7 @@ export async function ResolveFSPathAndCodeForURI(
2524 /**
2625 * Get official FSPath for root file
2726 */
28- const fsPath = realpathSync ( CleanPath ( parsed . fsPath ) ) ;
27+ const fsPath = GetFSPath ( url ) ;
2928
3029 /**
3130 * Check if PRO code
You can’t perform that action at this time.
0 commit comments