Skip to content

Commit

Permalink
Merge branch 'feat/quick-fix-enum-const-property' of github.com:jigx-…
Browse files Browse the repository at this point in the history
…com/rh-yaml-language-server into feat/quick-fix-enum-const-property
  • Loading branch information
p-spacek committed Oct 18, 2024
2 parents be88cdc + e3e7687 commit ae9c4e9
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 118 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### 1.15.0
- Fix: some small type issues [#918](https://github.com/redhat-developer/yaml-language-server/pull/918)
- Add: volar-service-yaml to clients [#920](https://github.com/redhat-developer/yaml-language-server/pull/920)
- Fix: Remove ide-yaml from known clients [#921](https://github.com/redhat-developer/yaml-language-server/pull/921)
- Fix: schema loading performance [#923](https://github.com/redhat-developer/yaml-language-server/pull/923)
- Fix: undefined error in mergingResult.problemArgs [#924](https://github.com/redhat-developer/yaml-language-server/pull/924)
- Add: unify string insert text for array and property [#934](https://github.com/redhat-developer/yaml-language-server/pull/934)
- Add: Improve some special cases for selection ranges [#939](https://github.com/redhat-developer/yaml-language-server/pull/939)
- Fix: show all enums on hover [#942](https://github.com/redhat-developer/yaml-language-server/pull/942)
- Fix: update README syntax highlighting [#945](https://github.com/redhat-developer/yaml-language-server/pull/945)
- Fix: render examples as yaml on hover [#947](https://github.com/redhat-developer/yaml-language-server/pull/947)
- Fix: snippets in additionalProperties [#951](https://github.com/redhat-developer/yaml-language-server/pull/951)
- Fix: crash when url is undefined [#954](https://github.com/redhat-developer/yaml-language-server/pull/954)
- Fix: Add null check for customTags [#955](https://github.com/redhat-developer/yaml-language-server/pull/955)

Thanks to [Remco Haszing](https://github.com/remcohaszing), [Petr Spacek](https://github.com/p-spacek), [Tony](https://github.com/Legend-Master), [Gustav Eikaas](https://github.com/GustavEikaas), [Skip Baney](https://github.com/twelvelabs) and [Pierre Prinetti](https://github.com/pierreprinetti) for your contributions.

### 1.14.0
- Fix: Request textDocument/hover failed with message: Invalid regular expression: /(?s).*/: Invalid group [#874](https://github.com/redhat-developer/yaml-language-server/issues/874)
- Fix: nested anyof const [#888](https://github.com/redhat-developer/yaml-language-server/pull/888)
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The following settings are supported:

In order to use the custom tags in your YAML file you need to first specify the custom tags in the setting of your code editor. For example, we can have the following custom tags:

```YAML
```yaml
"yaml.customTags": [
"!Scalar-example scalar",
"!Seq-example sequence",
Expand All @@ -70,7 +70,7 @@ The !Scalar-example would map to a scalar custom tag, the !Seq-example would map

We can then use the newly defined custom tags inside our YAML file:

```YAML
```yaml
some_key: !Scalar-example some_value
some_sequence: !Seq-example
- some_seq_key_1: some_seq_value_1
Expand All @@ -93,7 +93,7 @@ myProject
you can do
```
```yaml
yaml.schemas: {
"https://json.schemastore.org/composer": "/myYamlFile.yaml"
}
Expand All @@ -109,7 +109,7 @@ and that will associate the composer schema with myYamlFile.yaml.

When associating a schema it should follow the format below

```json
```yaml
yaml.schemas: {
"url": "globPattern",
"Kubernetes": "globPattern"
Expand All @@ -118,23 +118,23 @@ yaml.schemas: {

e.g.

```json
```yaml
yaml.schemas: {
"https://json.schemastore.org/composer": "/*"
}
```

e.g.

```json
```yaml
yaml.schemas: {
"kubernetes": "/myYamlFile.yaml"
}
```

e.g.

```json
```yaml
yaml.schemas: {
"https://json.schemastore.org/composer": "/*",
"kubernetes": "/myYamlFile.yaml"
Expand All @@ -143,37 +143,37 @@ yaml.schemas: {

On Windows with full path:

```json
```yaml
yaml.schemas: {
"C:\\Users\\user\\Documents\\custom_schema.json": "someFilePattern.yaml",
}
```

On Mac/Linux with full path:

```json
```yaml
yaml.schemas: {
"/home/user/custom_schema.json": "someFilePattern.yaml",
}
```

Since `0.11.0` YAML Schemas can be used for validation:

```json
```yaml
"/home/user/custom_schema.yaml": "someFilePattern.yaml"
```
A schema can be associated with multiple globs using a json array, e.g.
```json
```yaml
yaml.schemas: {
"kubernetes": ["filePattern1.yaml", "filePattern2.yaml"]
}
```

e.g.

```json
```yaml
"yaml.schemas": {
"http://json.schemastore.org/composer": ["/*"],
"file:///home/johnd/some-schema.json": ["some.yaml"],
Expand All @@ -184,15 +184,15 @@ e.g.

e.g.

```json
```yaml
"yaml.schemas": {
"kubernetes": ["/myYamlFile.yaml"]
}
```

e.g.

```json
```yaml
"yaml.schemas": {
"http://json.schemastore.org/composer": ["/*"],
"kubernetes": ["/myYamlFile.yaml"]
Expand All @@ -205,7 +205,7 @@ You can also use relative paths when working with multi root workspaces.

Suppose you have a multi root workspace that is laid out like:

```
```yaml
My_first_project:
test.yaml
my_schema.json
Expand All @@ -216,7 +216,7 @@ My_second_project:
You must then associate schemas relative to the root of the multi root workspace project.
```
```yaml
yaml.schemas: {
"My_first_project/my_schema.json": "test.yaml",
"My_second_project/my_schema2.json": "test2.yaml"
Expand All @@ -229,7 +229,7 @@ yaml.schemas: {

Suppose a file is meant to be a component of an existing schema (like a `job.yaml` file in a circleci orb), but there isn't a standalone schema that you can reference. If there is a nested schema definition for this subcomponent, you can reference it using a url fragment, e.g.:

```
```yaml
yaml.schemas: {
"https://json.schemastore.org/circleciconfig#/definitions/jobs/additionalProperties": "/src/jobs/*.yaml",
}
Expand Down Expand Up @@ -275,7 +275,7 @@ The image is located at `quay.io/redhat-developer/yaml-language-server`

To run the image you can use:

```
```sh
docker run -it quay.io/redhat-developer/yaml-language-server:latest
```

Expand Down
4 changes: 2 additions & 2 deletions src/languageserver/handlers/settingsHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class SettingsHandler {

if (settings.yaml.schemaStore) {
this.yamlSettings.schemaStoreEnabled = settings.yaml.schemaStore.enable;
if (settings.yaml.schemaStore.url.length !== 0) {
if (settings.yaml.schemaStore.url?.length !== 0) {
this.yamlSettings.schemaStoreUrl = settings.yaml.schemaStore.url;
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ export class SettingsHandler {
private async setSchemaStoreSettingsIfNotSet(): Promise<void> {
const schemaStoreIsSet = this.yamlSettings.schemaStoreSettings.length !== 0;
let schemaStoreUrl = '';
if (this.yamlSettings.schemaStoreUrl.length !== 0) {
if (this.yamlSettings.schemaStoreUrl?.length !== 0) {
schemaStoreUrl = this.yamlSettings.schemaStoreUrl;
} else {
schemaStoreUrl = JSON_SCHEMASTORE_URL;
Expand Down
7 changes: 4 additions & 3 deletions src/languageservice/services/yamlCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class YamlCompletion {
proposed,
};

if (this.customTags.length > 0) {
if (this.customTags && this.customTags.length > 0) {
this.getCustomTagValueCompletions(collector);
}

Expand Down Expand Up @@ -925,7 +925,8 @@ export class YamlCompletion {
if (propertySchema) {
this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types, 'value');
}
} else if (s.schema.additionalProperties) {
}
if (s.schema.additionalProperties) {
this.addSchemaValueCompletions(s.schema.additionalProperties, separatorAfter, collector, types, 'value');
}
}
Expand Down Expand Up @@ -1205,7 +1206,7 @@ export class YamlCompletion {
insertText = `\${${insertIndex++}:0}`;
break;
case 'string':
insertText = `\${${insertIndex++}:""}`;
insertText = `\${${insertIndex++}}`;
break;
case 'object':
{
Expand Down
Loading

0 comments on commit ae9c4e9

Please sign in to comment.