Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(language-service): do not treat file URIs as general URLs #39917

Closed
wants to merge 1 commit into from

Commits on Dec 3, 2020

  1. fix(language-service): do not treat file URIs as general URLs

    In the past, the legacy (VE-based) language service would use a
    `UrlResolver` instance to resolve file paths, primarily for compiler
    resources like external templates. The problem with this is that the
    UrlResolver is designed to resolve URLs in general, and so for a path
    like `/a/b/#c`, `#c` is treated as hash/fragment rather than as part
    of the path, which can lead to unexpected path resolution (f.x.,
    `resolve('a/b/#c/d.ts', './d.html')` would produce `'a/b/d.html'` rather
    than the expected `'a/b/#c/d.html'`).
    
    This commit resolves the issue by using Node's `path` module to resolve
    file paths directly, which aligns more with how resources are resolved
    in the Ivy compiler.
    
    The testing story here is not great, and the API for validating a file
    path could be a little bit prettier/robust. However, since the VE-based
    language service is going into more of a "maintenance mode" now that
    there is a clear path for the Ivy-based LS moving forward, I think it is
    okay not to spend too much time here.
    
    Closes angular/vscode-ng-language-service#892
    Closes angular/vscode-ng-language-service#1001
    ayazhafiz committed Dec 3, 2020
    Copy the full SHA
    124ff3c View commit details
    Browse the repository at this point in the history