vscode-yaml
vscode-yaml copied to clipboard
Autocomplete and Linting are Broken
Issue Type: Bug
- With extension version 0.18.0 installed, create a file named
.gitlab-ci.yml
- The window looks like this:
Note the "Gitlab CI configuration (gitlab-ci.json)" above line 1
- Autocomplete and linting work fine:
- Update the extension to 0.19.0.
"Gitlab CI configuration (gitlab-ci.json)" is gone
- Linting and autocomplete no longer work
Extension version: 0.19.0 VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:13:13.157Z) OS version: Windows_NT x64 10.0.19042
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 31.87GB (27.45GB free) |
Process Argv | --crash-reporter-id 87f27f2c-dd1b-40a9-ae8b-7ff74ea6d775 |
Screen Reader | no |
VM | 0% |
@OutOfFocus4 I just test .gitlab-ci.yml
file and autocomplete works for me on 0.19.0
(on macos):
Can you check that you have access to https://www.schemastore.org/api/json/catalog.json ?
I tried on a Mac and it didn't work, either. I can reach the schema store.
I did some more investigating and found that if I uninstall the extension and delete the JSON schema cache from my filesystem, the cache will be regenerated if I install version 0.18 of the extension. If I remove the extension, delete the cache, and install version 0.19, the cache directory isn't created.
Hm, that is very strange, we not change anything related to schema cache in 0.19.0
@OutOfFocus4 I think I know what reason of this issue.
On 0.19.0
we upgrade to latest json-languageservice(which we use to implement most features) an in latest release they changed way to handle file match patterns. Now it(we) respects glob patterns.
In JSON Schema store gitlab-ci
defined as:
{
"name": "gitlab-ci",
"description": "JSON schema for configuring Gitlab CI",
"fileMatch": [
"*.gitlab-ci.yml"
],
"url": "https://json.schemastore.org/gitlab-ci.json"
}
Prior 0.19.0
we always match end of file name(basically we doesn't support glob patterns, even if our docs says opposite).
To test my guess, just rename your file to <some>.gitlab-ci.yml
to match fileMatch
in JSON Schema
I renamed .gitlab-ci.yml
to a.gitlab-ci.yml
, and it started to work.
Shouldn't .gitlab-ci.yml
work with *.gitlab-ci.yml
, since *
can match zero characters?
Yes it should, I create PR to fix that https://github.com/redhat-developer/yaml-language-server/pull/467
@OutOfFocus4 Can you test latest 0.19.2
? It supposed to work.
@OutOfFocus4 Can you test latest
0.19.2
? It supposed to work.
I updated to 0.19.2
. .gitlab-ci.yml
still isn't seen as a GitLab CI configuration file.
@OutOfFocus4 I spend several hours to investigate this, and cannot find any clue why it didn't work for you. On my side it works:
https://user-images.githubusercontent.com/929743/119780796-e9366d80-bed2-11eb-98d9-98b69d0ad641.mov
The only possible reason it that your PC cannot load schema from jsonschema store. Can you make sure that you can get https://www.schemastore.org/api/json/catalog.json and https://json.schemastore.org/gitlab-ci.json
I just tried again on Windows, MacOS, and Ubuntu.
Windows 10:
MacOS:
Ubuntu:
Autocomplete and linting work in a.gitlab-ci.yml
, but not in .gitlab-ci.yml
with identical contents in the same directory.
I can actually reproduce this on my end. It looks like the glob pattern from the schema store isn't working. I can also reproduce this without the schema store by doing:
"yaml.schemas": {
"https://json.schemastore.org/gitlab-ci.json": "*.gitlab-ci.yml"
},
on 0.19.2
@JPinkney Thx, it seems that I need to start investigation from scratch
@JPinkney @OutOfFocus4
I give up, I try several laptops (with macos, windows and linux) and not able to reproduce this, but all of them used same wify/router to internet access.
The only reason for this I see in yours internet connection, that https://json.schemastore.org/gitlab-ci.json
is not available for some reasons.
As I demonstrated in my screenshots in my screenshots above, the extensions works with files named a.gitlab-ci.yml
, but not .gitlab-ci.yml
.
Is the globbing using an OS-level search function, and my OS preferences make it ignore dotfiles while yours includes dotfiles?
@OutOfFocus4 Are you using WSL?
I just updated to 0.20.0, and everything is working again. Should I close this issue, or keep it open until a root cause has been identified and regression tests are added?
Let's wait a bit.
That strange we do not change anything on schema matching between 0.19.2
and 0.20.0
.
Autocomplete does not work on Windows 10 and version v0.22.0. I tried on an other computer (Windows 11), it doesn't work more. Downgrading does not solve problem