@@ -478,11 +478,11 @@ export type SaveRuleConfigItem = { offRules: Set<string>; onRules: Set<string>;
478478 */
479479export namespace SaveRuleConfigs {
480480
481- export let inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined ) => string | undefined ;
481+ export let inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined , useRealpaths : boolean ) => string | undefined ;
482482
483483 const saveRuleConfigCache = new LRUCache < string , SaveRuleConfigItem | null > ( 128 ) ;
484484 export async function get ( uri : string , settings : TextDocumentSettings & { library : ESLintModule } ) : Promise < SaveRuleConfigItem | undefined > {
485- const filePath = inferFilePath ( uri ) ;
485+ const filePath = inferFilePath ( uri , settings . useRealpaths ) ;
486486 let result = saveRuleConfigCache . get ( uri ) ;
487487 if ( filePath === undefined || result === null ) {
488488 return undefined ;
@@ -755,7 +755,7 @@ export namespace ESLint {
755755
756756 let connection : ProposedFeatures . Connection ;
757757 let documents : TextDocuments < TextDocument > ;
758- let inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined ) => string | undefined ;
758+ let inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined , useRealpaths : boolean ) => string | undefined ;
759759 let loadNodeModule : < T > ( moduleName : string ) => T | undefined ;
760760
761761 const languageId2ParserRegExp : Map < string , RegExp [ ] > = function createLanguageId2ParserRegExp ( ) {
@@ -823,7 +823,7 @@ export namespace ESLint {
823823 const document2Settings : Map < string , Promise < TextDocumentSettings > > = new Map < string , Promise < TextDocumentSettings > > ( ) ;
824824 const formatterRegistrations : Map < string , Promise < Disposable > > = new Map ( ) ;
825825
826- export function initialize ( $connection : ProposedFeatures . Connection , $documents : TextDocuments < TextDocument > , $inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined ) => string | undefined , $loadNodeModule : < T > ( moduleName : string ) => T | undefined ) {
826+ export function initialize ( $connection : ProposedFeatures . Connection , $documents : TextDocuments < TextDocument > , $inferFilePath : ( documentOrUri : string | TextDocument | URI | undefined , useRealpaths : boolean ) => string | undefined , $loadNodeModule : < T > ( moduleName : string ) => T | undefined ) {
827827 connection = $connection ;
828828 documents = $documents ;
829829 inferFilePath = $inferFilePath ;
@@ -870,8 +870,8 @@ export namespace ESLint {
870870 return settings ;
871871 }
872872 settings . resolvedGlobalPackageManagerPath = GlobalPaths . get ( settings . packageManager ) ;
873- const filePath = inferFilePath ( document ) ;
874- const workspaceFolderPath = settings . workspaceFolder !== undefined ? inferFilePath ( settings . workspaceFolder . uri ) : undefined ;
873+ const filePath = inferFilePath ( document , settings . useRealpaths ) ;
874+ const workspaceFolderPath = settings . workspaceFolder !== undefined ? inferFilePath ( settings . workspaceFolder . uri , settings . useRealpaths ) : undefined ;
875875 let assumeFlatConfig :boolean = false ;
876876 const hasUserDefinedWorkingDirectories : boolean = configuration . workingDirectory !== undefined ;
877877 const workingDirectoryConfig = configuration . workingDirectory ?? { mode : ModeEnum . location } ;
@@ -1097,7 +1097,7 @@ export namespace ESLint {
10971097 if ( ! isFile ) {
10981098 formatterRegistrations . set ( uri , connection . client . register ( DocumentFormattingRequest . type , options ) ) ;
10991099 } else {
1100- const filePath = inferFilePath ( uri ) ! ;
1100+ const filePath = inferFilePath ( uri , settings . useRealpaths ) ! ;
11011101 await ESLint . withClass ( async ( eslintClass ) => {
11021102 if ( ! await eslintClass . isPathIgnored ( filePath ) ) {
11031103 formatterRegistrations . set ( uri , connection . client . register ( DocumentFormattingRequest . type , options ) ) ;
@@ -1183,14 +1183,14 @@ export namespace ESLint {
11831183 if ( uri . scheme !== 'file' ) {
11841184 if ( settings . workspaceFolder !== undefined ) {
11851185 const ext = LanguageDefaults . getExtension ( document . languageId ) ;
1186- const workspacePath = inferFilePath ( settings . workspaceFolder . uri ) ;
1186+ const workspacePath = inferFilePath ( settings . workspaceFolder . uri , settings . useRealpaths ) ;
11871187 if ( workspacePath !== undefined && ext !== undefined ) {
11881188 return path . join ( workspacePath , `test.${ ext } ` ) ;
11891189 }
11901190 }
11911191 return undefined ;
11921192 } else {
1193- return inferFilePath ( uri ) ;
1193+ return inferFilePath ( uri , settings . useRealpaths ) ;
11941194 }
11951195 }
11961196
@@ -1418,14 +1418,14 @@ export namespace ESLint {
14181418 missingModuleReported . clear ( ) ;
14191419 }
14201420
1421- function tryHandleMissingModule ( error : any , document : TextDocument , library : ESLintModule ) : Status | undefined {
1421+ function tryHandleMissingModule ( error : any , document : TextDocument , library : ESLintModule , settings : TextDocumentSettings ) : Status | undefined {
14221422 if ( ! error . message ) {
14231423 return undefined ;
14241424 }
14251425
14261426 function handleMissingModule ( plugin : string , module : string , error : ESLintError ) : Status {
14271427 if ( ! missingModuleReported . has ( plugin ) ) {
1428- const fsPath = inferFilePath ( document ) ;
1428+ const fsPath = inferFilePath ( document , settings . useRealpaths ) ;
14291429 missingModuleReported . set ( plugin , library ) ;
14301430 if ( error . messageTemplate === 'plugin-missing' ) {
14311431 connection . console . error ( [
0 commit comments