vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Autocomplete and Linting are Broken

Open OutOfFocus4 opened this issue 3 years ago • 19 comments

Issue Type: Bug

  1. With extension version 0.18.0 installed, create a file named .gitlab-ci.yml
  2. The window looks like this: image Note the "Gitlab CI configuration (gitlab-ci.json)" above line 1
  3. Autocomplete and linting work fine: image
  4. Update the extension to 0.19.0. image "Gitlab CI configuration (gitlab-ci.json)" is gone
  5. Linting and autocomplete no longer work image

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 avatar May 14 '21 13:05 OutOfFocus4

@OutOfFocus4 I just test .gitlab-ci.yml file and autocomplete works for me on 0.19.0 (on macos): Screenshot 2021-05-14 at 16 31 04

Can you check that you have access to https://www.schemastore.org/api/json/catalog.json ?

evidolob avatar May 14 '21 13:05 evidolob

I tried on a Mac and it didn't work, either. I can reach the schema store. Screen Shot 2021-05-14 at 10 08 42 AM

OutOfFocus4 avatar May 14 '21 14:05 OutOfFocus4

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.

OutOfFocus4 avatar May 17 '21 13:05 OutOfFocus4

Hm, that is very strange, we not change anything related to schema cache in 0.19.0

evidolob avatar May 17 '21 13:05 evidolob

@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

evidolob avatar May 19 '21 09:05 evidolob

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?

OutOfFocus4 avatar May 20 '21 12:05 OutOfFocus4

Yes it should, I create PR to fix that https://github.com/redhat-developer/yaml-language-server/pull/467

evidolob avatar May 20 '21 12:05 evidolob

@OutOfFocus4 Can you test latest 0.19.2? It supposed to work.

evidolob avatar May 21 '21 17:05 evidolob

@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.

image

OutOfFocus4 avatar May 23 '21 11:05 OutOfFocus4

@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

evidolob avatar May 27 '21 07:05 evidolob

I just tried again on Windows, MacOS, and Ubuntu.

Windows 10: image

MacOS: YAML MacOS

Ubuntu: YAML Ubuntu

Autocomplete and linting work in a.gitlab-ci.yml, but not in .gitlab-ci.yml with identical contents in the same directory.

OutOfFocus4 avatar May 27 '21 13:05 OutOfFocus4

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 avatar May 27 '21 13:05 JPinkney

@JPinkney Thx, it seems that I need to start investigation from scratch

evidolob avatar May 27 '21 14:05 evidolob

@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.

evidolob avatar Jun 15 '21 14:06 evidolob

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 avatar Jun 16 '21 13:06 OutOfFocus4

@OutOfFocus4 Are you using WSL?

evidolob avatar Jun 16 '21 14:06 evidolob

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?

OutOfFocus4 avatar Jun 16 '21 16:06 OutOfFocus4

Let's wait a bit. That strange we do not change anything on schema matching between 0.19.2 and 0.20.0 .

evidolob avatar Jun 16 '21 16:06 evidolob

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

fiffly avatar Aug 21 '21 04:08 fiffly