p-spacek / yaml-language-server Goto Github PK
View Code? Open in Web Editor NEWThis project forked from redhat-developer/yaml-language-server
Language Server for Yaml Files
License: MIT License
This project forked from redhat-developer/yaml-language-server
Language Server for Yaml Files
License: MIT License
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.
it can be probable done by fix
Array code completion does't work in some scenarios
Completion with defaultSnippet doesn't work in this scenario:
array:
#invoke here without "-"
This bug can be observe by code completion in this scenario:
Array:
Object works fine:
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.
This is expected behavior - fixed in yaml-ast-parser
see description
see description
it will be possible write inline objects with standard object completion:
value: context.data.component.
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
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: '',
})
);
});
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',
},
},
},
},
},
},
display completion on nested objects on middle of the prop
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.
object is not very descriptive, there could be info from referenceoffer jump to different schemas:
Merge message together.
Replace general object by more describable text.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.