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

CSS Language Server Errors - URI contains an authority component #79215

Closed
iantrudell opened this issue Aug 15, 2019 · 11 comments
Closed

CSS Language Server Errors - URI contains an authority component #79215

iantrudell opened this issue Aug 15, 2019 · 11 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling verified Verification succeeded
Milestone

Comments

@iantrudell
Copy link

Issue Type: Bug

Since the latest build, I've been getting these CSS Language Server Errors:

[Error - 10:17:42 AM] Error while computing document links for file:///c%3A/Users/**********/******/scss/custom.scss: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
Error: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:737585
    at t.e (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:737900)
    at new t (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:739582)
    at t.e.with (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:738717)
    at o (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:744863)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:744895
    at t.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:744998)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:743828
    at Object.next (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:743933)
    at s (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:742702)

The lines in question are like this:

.image {
    background-image: url(gantry-theme://images/image.png);
}

Doesn't seem to like that gantry-theme:// prefix for the image.

Any help would be much appreciated!

VS Code version: Code 1.37.0 (036a6b1, 2019-08-08T02:33:50.993Z)
OS version: Windows_NT x64 10.0.15063

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz (4 x 2712)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.88GB (4.51GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (26)
Extension Author (truncated) Version
vscode-apollo apo 1.9.2
vscode-intelephense-client bme 1.1.6
bracket-pair-colorizer Coe 1.0.61
tslint eg2 1.0.44
json-tools eri 1.0.2
gitlab-workflow fat 2.1.1
matlab Gim 1.2.0
minify Hoo 0.4.3
composer ika 0.7.1
phpcs ika 1.0.5
docthis joe 0.7.1
sftp lix 1.12.8
code-beautifier mic 2.3.3
vscode-autoprefixer mrm 2.2.0
vscode-postcss-sorting mrm 3.0.1
python ms- 2019.8.30787
powershell ms- 2019.5.0
vsliveshare ms- 1.0.694
debugger-for-chrome msj 4.11.7
color-highlight nau 2.3.0
vscode-phpcbf per 0.0.8
awesome-vhdl puo 0.0.1
prettier-now rem 1.4.9
stylelint shi 0.51.0
vscode-scss-formatter sib 1.4.2
html-css-class-completion Zig 1.19.0
@octref octref added bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling labels Aug 15, 2019
@octref octref added this to the August 2019 milestone Aug 15, 2019
@octref octref modified the milestones: August 2019, September 2019 Aug 27, 2019
@sammoore
Copy link

sammoore commented Aug 28, 2019

Is there any way to workaround and/or silence this in the meantime? We are facing the same issue under NativeScript, which uses res:// URLs.

@iantrudell
Copy link
Author

iantrudell commented Sep 17, 2019

Any updates on this? Repeatedly getting "A request has failed" warnings and performance is suffering.

@octref
Copy link
Contributor

octref commented Sep 17, 2019

This doesn't repro for me anymore...Is the repro still editing a CSS file like this?

.image {
    background-image: url(gantry-theme://images/image.png);
}

Does this repro when you turn off all extensions?

@iantrudell
Copy link
Author

Yes, it is still an issue even with all extensions disabled.

request-has-failed

It does not like background-image: url(gantry-theme://images/image-name.png);

Keeps saying if a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character...

octref added a commit to microsoft/vscode-css-languageservice that referenced this issue Sep 25, 2019
@octref
Copy link
Contributor

octref commented Sep 25, 2019

This still works fine for me. I added a test case and the test passes on all platforms, including Windows. You can clone the repo and run the test suite yourself with:

git clone git@github.com:microsoft/vscode-css-languageservice.git
cd vscode-css-languageservice
yarn && yarn test

You can also try this:

  • Set css.trace.server to verbose

  • Have a SCSS file with only. Make one edit.

    .image {
      background-image: url(gantry-theme://images/image.png);
    }
  • Go to Output -> CSS Language Server

  • You should see log something like below. Paste them here:

    [Trace - 10:56:23 AM] Sending request 'textDocument/documentLink - (174)'.
    Params: {
        "textDocument": {
            "uri": "file:///c%3A/Users/octref/Desktop/helloworld/foo.scss"
        }
    }
    
    [Trace - 10:56:23 AM] Received response 'textDocument/documentLink - (174)' in 2ms.
    Result: [
        {
            "range": {
                "start": {
                    "line": 1,
                    "character": 26
                },
                "end": {
                    "line": 1,
                    "character": 57
                }
            },
            "target": "gantry-theme://images/image.png"
        }
    ]
    

@octref octref added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug labels Sep 25, 2019
@octref octref modified the milestones: September 2019, October 2019 Sep 30, 2019
@iantrudell
Copy link
Author

I was able to recreate the error by adding in a keyframes animation-name:

#navigation {

    .wrapper & {
        background: #3d3d3d url(gantry-media://gradient-overlay.png);

        a.logo {
            >img {
                transition: cubic-bezier(0.4, 0, 1, 1) 150ms;
            }

            &:hover>img {
                animation-name: bounce-4;
                animation-timing-function: ease;
            }
        }
    }

}

@keyframes bounce-4 {
    0% {
        transform: scale(1, 1) translateY(0);
    }

    10% {
        transform: scale(1.1, .9) translateY(0);
    }

    30% {
        transform: scale(.9, 1.1) translateY(0);
    }

    50% {
        transform: scale(1, 1) translateY(0);
    }

    100% {
        transform: scale(1, 1) translateY(0);
    }
}

Without the animation, it does not error.

Full verbose output:

[Trace - 11:36:20 AM] Sending request 'textDocument/documentColor - (244)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    }
}


[Trace - 11:36:20 AM] Sending request 'textDocument/documentLink - (245)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    }
}


[Trace - 11:36:20 AM] Sending request 'textDocument/codeAction - (246)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 0
        },
        "end": {
            "line": 0,
            "character": 0
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 11:36:20 AM] Sending request 'textDocument/documentSymbol - (247)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    }
}


[Trace - 11:36:20 AM] Received response 'textDocument/documentColor - (244)' in 36ms.
Result: [
    {
        "color": {
            "red": 0.23921568627450981,
            "green": 0.23921568627450981,
            "blue": 0.23921568627450981,
            "alpha": 1
        },
        "range": {
            "start": {
                "line": 3,
                "character": 20
            },
            "end": {
                "line": 3,
                "character": 27
            }
        }
    }
]


[Trace - 11:36:20 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "Error while computing document links for file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character\nError: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character\n    at c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:795666\n    at t.e (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:795981)\n    at new t (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:797663)\n    at t.e.with (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:796798)\n    at o (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:802968)\n    at c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:803000\n    at t.<anonymous> (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:803103)\n    at c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:801909\n    at Object.next (c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:802014)\n    at c:\\Program Files\\Microsoft VS Code\\resources\\app\\extensions\\css-language-features\\server\\dist\\cssServerMain.js:1:800950"
}


[Error - 11:36:20 AM] Error while computing document links for file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
Error: [UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:795666
    at t.e (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:795981)
    at new t (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:797663)
    at t.e.with (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:796798)
    at o (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:802968)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:803000
    at t.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:803103)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:801909
    at Object.next (c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:802014)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\css-language-features\server\dist\cssServerMain.js:1:800950
[Trace - 11:36:20 AM] Received response 'textDocument/documentLink - (245)' in 38ms.
Result: []


[Trace - 11:36:20 AM] Received response 'textDocument/codeAction - (246)' in 38ms.
Result: []


[Trace - 11:36:20 AM] Received response 'textDocument/documentSymbol - (247)' in 38ms.
Result: [
    {
        "name": "#navigation",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 17,
                    "character": 1
                }
            }
        }
    },
    {
        "name": ".wrapper &",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 2,
                    "character": 4
                },
                "end": {
                    "line": 15,
                    "character": 5
                }
            }
        }
    },
    {
        "name": "a.logo",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 5,
                    "character": 8
                },
                "end": {
                    "line": 14,
                    "character": 9
                }
            }
        }
    },
    {
        "name": ">img",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 6,
                    "character": 12
                },
                "end": {
                    "line": 8,
                    "character": 13
                }
            }
        }
    },
    {
        "name": "&:hover>img",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 10,
                    "character": 12
                },
                "end": {
                    "line": 13,
                    "character": 13
                }
            }
        }
    },
    {
        "name": "@keyframes bounce-4",
        "kind": 5,
        "location": {
            "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss",
            "range": {
                "start": {
                    "line": 19,
                    "character": 0
                },
                "end": {
                    "line": 39,
                    "character": 1
                }
            }
        }
    }
]


[Trace - 11:36:20 AM] Sending request 'textDocument/foldingRange - (248)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    }
}


[Trace - 11:36:20 AM] Sending request 'textDocument/codeAction - (249)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/username/Documents/csslanguageservertest/test.scss"
    },
    "range": {
        "start": {
            "line": 39,
            "character": 1
        },
        "end": {
            "line": 39,
            "character": 1
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 11:36:20 AM] Received response 'textDocument/foldingRange - (248)' in 3ms.
Result: [
    {
        "startLine": 0,
        "endLine": 16
    },
    {
        "startLine": 2,
        "endLine": 14
    },
    {
        "startLine": 5,
        "endLine": 13
    },
    {
        "startLine": 6,
        "endLine": 7
    },
    {
        "startLine": 10,
        "endLine": 12
    },
    {
        "startLine": 19,
        "endLine": 38
    },
    {
        "startLine": 20,
        "endLine": 21
    },
    {
        "startLine": 24,
        "endLine": 25
    },
    {
        "startLine": 28,
        "endLine": 29
    },
    {
        "startLine": 32,
        "endLine": 33
    },
    {
        "startLine": 36,
        "endLine": 37
    }
]


[Trace - 11:36:20 AM] Received response 'textDocument/codeAction - (249)' in 4ms.
Result: []

@octref
Copy link
Contributor

octref commented Oct 2, 2019

Thanks, a minimal repro is scss file with below content:

#navigation {
  background: #3d3d3d url(gantry-media://gradient-overlay.png);
}

@octref octref added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Oct 2, 2019
@octref
Copy link
Contributor

octref commented Oct 22, 2019

FYI, gantry-media://gradient-overlay.png is not a good URI, your might think path is /gradient-overlay.png, but gradient-overlay.png is parsed as URI authority and path is empty.

octref added a commit that referenced this issue Oct 22, 2019
@Tyriar
Copy link
Member

Tyriar commented Oct 29, 2019

Is this expected to happen after ctrl+clicking the link?

image

@octref
Copy link
Contributor

octref commented Oct 29, 2019

Yeah, there's no valid resolution to that URI. The only change I made is CSS LS do not complain.

@Tyriar Tyriar added the verified Verification succeeded label Oct 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug css-less-scss Issues and items concerning CSS,Less,SCSS styling verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants