Giter Site home page Giter Site logo

p-spacek / yaml-language-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redhat-developer/yaml-language-server

0.0 0.0 1.0 31.91 MB

Language Server for Yaml Files

License: MIT License

TypeScript 99.75% JavaScript 0.23% Dockerfile 0.02%

yaml-language-server's People

Contributors

928pjy avatar andrew-stripe avatar andxu avatar apupier avatar bollwyvl avatar dellison avatar dependabot[bot] avatar dev-bz avatar evidolob avatar fbaligand avatar gorkem avatar grant-d avatar iquiw avatar joshuawilson avatar jpinkney avatar masterodin avatar mickaelistria avatar msivasubramaniaan avatar p-spacek avatar pengx17 avatar rcjsuen avatar remcohaszing avatar rickcowan avatar robb-j avatar segevfiner avatar ssbarnea avatar tpai avatar trajamsmith avatar vidminas avatar yaegassy avatar

yaml-language-server's Issues

Completion-Snippet: add parameters to defaultSnippets to specify the type and simbolKind

When object is type anyOf (array: null | string[]) some code completion doesn't work properly.
For example snippets on array it's not working very well.

"anyOf_arrayObj": {
  "anyOf": [
    {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    {
      "type": "null"
    }
  ],
  "defaultSnippets": [
    {
      "label": "- (array item)",
      "type": "array",
      "suggestionKind": 9,
      "body": {
        "key": ""
      }
    }
  ]
},

Helps also in scenarios where yaml parser doesn't know that parent is array:

anyOf_arrayObj:
  # invoke array completion here

This new parameters can specify:

  • type: type of snippet.
  • symbolKind: id of symbol that is displayed on completion panel.

This feature probably doesn't solve the cause of the problem. But offers workaround.

Describe alternatives you have considered

it can be probable done by fix
Array code completion does't work in some scenarios

wrong array parsing ending by newLine with no indent

Describe the bug

This bug can be observe by code completion in this scenario:
Array:

bug.description.mov

Object works fine:

objects.works.fine.mov

Bug is in dependent project yaml-ast-parser, when array node ending with empty lines with no indent
Similar example with object instead of array works fine.

Expected Behavior

This is expected behavior - fixed in yaml-ast-parser

after.fix.mov

Current Behavior

see description

Steps to Reproduce

see description

Environment

  • Windows
  • Mac
  • Linux
  • probably on every environment

Array code completion does't work in some scenarios

Describe the bug

Array code completion does't work in some scenarios
See attached schema
array.schema.json.txt

test_simpleArrayObject:
  #not ok
#  - # ok
  - obj1:
      name: 1  
  # ok,
# - #ok  
  
test_array_anyOf_strAndObj:
  #not ok
# - #not ok
  - obj1:
      name: 1
  # not ok
# - #not ok
     
test_array_anyOf_2objects:
  # not ok when type is anyOf
  - obj1:
      name: 5  
  # not ok when type is anyOf
# - #  OK


#test_anyOfObjectAndNull:#not ok, should be null or obj1

test_anyOfObjectAndNull:
  #not ok, should be null or obj1

test_anyOfStrArrAndNull:
  #notOk
  - test
  #not ok 
# - #notOk
  

test_anyOfObjArrAndNull:
  #notOk
# - #ok 
  - obj1:
      name: 5
  #ok

any of doesn't work if it's deeply nested and leading by newLine

Describe the bug

this test doesn't work

scripts:
  sample:
    detail:
      detail2:
         #cursore here
newLine: test #if the new line is indented to the right, completion works        
it.skip('Autocomplete with nextLine  - nested object anyOf', async () => {
    languageService.addSchema(SCHEMA_ID, {
      type: 'object',
      properties: {
        scripts: {
          type: 'object',
          properties: {
            sample: {
              type: 'object',
              properties: {
                detail: {
                  type: 'object',
                  properties: {
                    detail2: {
                      anyOf: [
                        {
                          type: 'string',
                          const: 'const1',
                        },
                        {
                          type: 'object',
                          properties: {
                            list: {
                              type: 'string',
                            },
                            parent: {
                              type: 'string',
                            },
                          },
                        },
                      ],
                    },
                  },
                },
              },
            },
          },
        },
      },
    });
    const content = 'scripts:\n  sample:\n    detail:\n      detail2:\n        ';
    const completion = await parseSetup(content + '\nnewLine: test', 4, 8);
    completion;
    expect(completion.items.length).equal(1);
    expect(completion.items[0]).to.be.deep.equal(
      createExpectedCompletion('detail2', 'detail2: ${1:test}', 3, 6, 3, 6, 10, 2, {
        documentation: '',
      })
    );
  });

Expected Behavior

Current Behavior

Steps to Reproduce

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

nested object doesn't work with completion in the middle of the property

Describe the bug

the nested object doesn't work with completion in the middle of the property
ok:

script:
  sam #completion is successfully displayed

not ok:

script:
  sample:
    det #completion is not displayed

consider this schema

type: 'object',
          properties: {
            scripts: {
              type: 'object',
              properties: {
                sample: {
                  type: 'object',
                  properties: {
                    detail: {
                      type: 'string',
                      default: 'test',
                    },
                  },
                },
              },
            },
          },

Expected Behavior

display completion on nested objects on middle of the prop

Merge warning messages

Is your enhancement related to a problem? Please describe.

When there are more possible warning messages from different schemas or objects connected to specific problem, validator takes only the first one and it's hard to recognize the core of the problem.

MissingProp-Before

IncorrectType-Before

object is not very descriptive, there could be info from reference

offer jump to different schemas:
JumpToSchema-Before

Describe the solution you would like

Merge message together.
MissingProp-After
Const-After
Replace general object by more describable text.
IncorrectType-After

Show possible schemas by codeAction.
JumpToSchema-After

add support for another languageId than 'yaml'

Be able to add different type of language (different fileExtension) but with same syntax and support as yaml.

Formatting doesn't work here, because it's registered constantly to 'yaml' language.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.