@@ -243,18 +243,17 @@ export function isfsDocumentName(uri: vscode.Uri, csp?: boolean, pkg = false): s
243243 * error when `uri`'s path is not in "canonical form".
244244 */
245245function validateUriIsCanonical ( uri : vscode . Uri ) : void {
246+ const numDots = uri . path . split ( "." ) . length - 1 ;
247+ const lastFour = uri . path . slice ( - 4 ) ;
246248 if (
247249 ! isfsConfig ( uri ) . csp &&
248- [ ".cls" , ".mac" , ".int" , ".inc" ] . includes ( uri . path . slice ( - 4 ) . toLowerCase ( ) ) &&
249- // dotted packages
250- ( uri . path . split ( "." ) . length > 2 ||
251- // extension has wrong case
252- ! [ ".cls" , ".mac" , ".int" , ".inc" ] . includes ( uri . path . slice ( - 4 ) ) ||
250+ [ ".cls" , ".mac" , ".int" , ".inc" ] . includes ( lastFour . toLowerCase ( ) ) &&
251+ // extension has wrong case
252+ ( ! [ ".cls" , ".mac" , ".int" , ".inc" ] . includes ( lastFour ) ||
253253 // short alias for %Library class
254- ( uri . path . startsWith ( "/%" ) &&
255- uri . path . slice ( - 4 ) == ".cls" &&
256- uri . path . split ( "." ) . length == 2 &&
257- uri . path . split ( "/" ) . length == 2 ) )
254+ ( uri . path . startsWith ( "/%" ) && lastFour == ".cls" && numDots == 1 && uri . path . split ( "/" ) . length == 2 ) ||
255+ // dotted packages
256+ ( numDots > 1 && ! ( numDots == 2 && / \. G ? \d \. i n t $ / . test ( uri . path ) ) ) )
258257 ) {
259258 throw vscode . FileSystemError . FileNotFound ( uri ) ;
260259 }
0 commit comments