Comments (28)
This is available in 0.0.7 of the language server!
from yaml-language-server.
I have something like this set up:
"customTags": [
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Ref",
"!Ref Scalar",
"!Sub",
"!GetAtt",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
]
But I am still getting this error: https://i.imgur.com/gj32GKq.png
from yaml-language-server.
@JPinkney YOU, SIR... are a hero.
from yaml-language-server.
Hey, sorry to re-open an old issue, but I can't make the server to work with AWS CloudFormation. Is there a specific setting to input somewhere?
I'm on VS Code and I tried to reference to a schema, tried different ways, but it just doesn't work.
Thank you in advance!
from yaml-language-server.
Bump. I was wanting to know if there is a setting I have to do
from yaml-language-server.
You have to manually add custom tags to the yaml.customTags setting. Here is the explanation from readme: yaml.customTags: Array of custom tags that the parser will validate against. It has two ways to be used. Either an item in the array is a custom tag such as "!Ref" or you can specify the type of the object !Ref should be by doing "!Ref Scalar". For example: ["!Ref", "!Some-Tag Scalar"]. The type of object can be one of Scalar, Sequence, Mapping, Map.
There are a few issues with custom tags that are known: #77.
From the snippet posted above I believe it would be
yaml.customTags: [
"!Sub"
]
or
yaml.customTags: [
"!Sub scalar"
]
(it defaults the type to scalar so you don't have to specify the scalar for the property)
from yaml-language-server.
So all I have to do is, for each custom tag I have, I add them, AND a version with them with the word "Scalar" next to it?
from yaml-language-server.
"!Ref",
"!Ref Scalar",
You might be running into the issue in #77 (i'm not sure on first glance).
However, those two tags mean the same thing and the type should be lower cased (if you include it). You should only have to do either "!Ref" or "!Ref scalar".
If there still is an error after that can you open a new issue just to make sure everything is logged so it doesn't get forgotten!
from yaml-language-server.
Hi @JPinkney,
Thanks for the help, so far I've kept it lean and only used the !Ref tag at the moment.
I have the langserv set up like so:
"yaml": {
"module": "/Users/esn89/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml"],
"cwd": "./src",
"settings": {
"format.enable": true,
"validate": true,
"completion": true,
"customTags": [
"!Ref scalar"
]
}
}
And I still have the same error of:
[yaml] [E] unknown tag <!Ref>
I am happy to say that the format settings, validate settings and completion works.
Am I doing something obviously wrong?
from yaml-language-server.
It looks right to me. I'm not sure if the customTags isn't being synced or whats going on because its working through VSCode:
from yaml-language-server.
Thanks for your reply.
I am wondering if it could be a result of using a different client?
Right now I am using:
https://github.com/neoclide/coc.nvim/
And my entire set up looks like this:
"languageserver": {
"yaml": {
"module": "/Users/esn89/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml"],
"cwd": "./src",
"settings": {
"format.enable": true,
"validate": true,
"completion": true,
"customTags": [
"!Ref scalar",
"!GetAtt",
"!FindInMap sequence",
"!FindInMap"
],
"schemas": {
"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json": "/*"
}
}
}
}
from yaml-language-server.
I'm not entirely sure, does turning off and on validation/completion settings etc work? Also for custom tags you cant have both !FindInMap sequence and !FindInMap currently. It will result in error (see discussion in #77 (comment) for more info)
from yaml-language-server.
Alright, so I have removed !FindInMap sequence turn off validation and completion (all set to false), however, I am still getting "[yaml] [E] unknown tag <!Ref>"
As this comes from the server, this should be client agnostic, yes?
from yaml-language-server.
As this comes from the server, this should be client agnostic, yes?
Correct, I was just trying to see whether the settings synced when you turned off validation and completion. When validation is false you shouldn't be getting any errors at all (regardless of if they exist or not). Do you know if there's any way to see the language server trace from that client?
from yaml-language-server.
I will see if I can make that happen.
from yaml-language-server.
So it turns out that my customTags: was in the wrong place. For my coc.nvim client, I have to do it like this to make it work:
"yaml.schemas": {
"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json": "/*"
},
"yaml.customTags": [
"!Ref",
"!GetAtt",
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Sub",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
],
"languageserver": {
"yaml": {
"module": "/Users/esn89/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml"],
"cwd": "./src",
"settings": {
"format.enable": true,
"validate": true,
"completion": true
}
}
}
Now it works. :D
My second question now is regarding the schemas, I have added the schema's as per:
https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json
For CloudFormation, and at the moment it isn't doing anything to the file. My guess is that by adding this schema, it will check for the valid type and whether or not the keys are valid.
I have been putting in random values in my yaml file, typos on purpose and the wrong types. However, it doesn't seem to detect errors. Do I have the right impression of schemas? IS that what they're supposed to do?
from yaml-language-server.
hmm, after setting yaml.schemas are you able to activate any of the other features that rely on a schemas (such as autocomplete)?
My only guesses are that the schema is slow to load, its not being set, or the schema may not catching everything. Can you try out
AWSTemplateFormatVersion: False
and tell me if it errors
Do I have the right impression of schemas? IS that what they're supposed to do?
Yes, depending on how well built the schemas are
from yaml-language-server.
Yup, I have reactivated them:
"yaml.schemas": {
"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json": "/*"
},
"yaml.customTags": [
"!Ref",
"!GetAtt",
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Sub",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
],
"languageserver": {
"yaml": {
"module": "/Users/esn89/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml"],
"cwd": "./src",
"settings": {
"format.enable": true,
"validate": true,
"completion": true
}
}
}
And with your suggestion of setting the flag to false, it doesn't seem to pick up any errors. In one of my resources like RDS::DBInstance, I put:
FOOOOOO: "bar"
as a property and that, I would assume would trigger an error.
Could it be a issue with the /*?
from yaml-language-server.
Could it be a issue with the /*?
The /* is just telling the schema to map to all yaml files.
setting the flag to false
By flag do you mean AWSTemplateFormatVersion: False
?
In one of my resources like RDS::DBInstance I put:
FOOOOOO: "bar" as a property and that, I would assume would trigger an error.
Can you post a snippet of that part its hard to diagnose without being able to see it. (I have no knowledge of AWS CloudFormation so I can only look at the schema and compare it with what I think it is doing).
Currently, can you trigger an error at all doing anything?
from yaml-language-server.
Sure thing, let me show you:
https://i.imgur.com/8SG2z3G.png
Here is a picture of my vim with this.
And the corresponding config is in my previous post, I haven't changed anything.
from yaml-language-server.
I might have to actually go in and install everything to see if I can get it working, because I'm not exactly sure why the errors aren't showing. On VSCode I get this:
from yaml-language-server.
Correct that is what it's supposed to happen, but it isn't what I am seeing. So it is working for you. Gah!!
You also have validation, completion and format installed?
I can give you the instructions to get this up running real quick (if you need/want):
- grab neovim
- install vim-plug into your neovim
- install coc.nvim
- install the coc-yaml for coc.nvim:
:CocInstall coc-yaml
- try my configuration file for coc.nvim.
:CocConfig
and paste my config:
{
"coc.preferences.diagnostic.errorSign": " ",
"coc.preferences.diagnostic.warningSign": " ",
"coc.preferences.diagnostic.infoSign": " ",
"coc.preferences.diagnostic.hintSign": "",
"yaml.schemas": {
"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json": "/*"
},
"yaml.customTags": [
"!Ref",
"!GetAtt",
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Sub",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
],
"languageserver": {
"yaml": {
"module": "/Users/esn89/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml"],
"cwd": "./src",
"settings": {
"format.enable": true,
"validate": true,
"completion": true
}
}
}
}
from yaml-language-server.
I think I may have found the issue. I'm still debugging but it looks like the trace is yielding this:
Which doesn't make sense at all. The schema is in a mangled format and thats probably why ?
EDIT: So I think I figured it out but i'm not really sure how to fix it. In neovim if you don't escape the dots inside the schema url then you get that mangled path (like above) but if you do you get:
because its trying to load a url with escaped dots.
from yaml-language-server.
What would happen if in the first picture you add dots to the broken down url, like:
"schemas": {
"https://raw." {
"githubusercontent." {
..... .....
The URL definitely does look mangled. So is this a behavior of coc?
from yaml-language-server.
I'm not sure if its a behaviour of coc or something else but I don't think its an issue with the language server itself (because it only tries to interpret that mangled URL and can't). In VSCode for example we would get:
without having to escape the dots or anything.
I'm not sure if it helps at all but these were the settings I was using.
{
"yaml.customTags": [
"!Ref",
"!GetAtt",
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Sub",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
],
"languageserver": {
"yaml": {
"module": "/Users/joshpinkney/.config/coc/extensions/node_modules/yaml-language-server/out/server/src/server.js",
"filetypes": ["yaml", "yml"],
"args": ["--stdio"]
}
},
"yaml.hover":true,
"yaml.validate": true,
"yaml.trace.server": "verbose",
"yaml.schemas": {"https://raw\.githubusercontent\.com/awslabs/goformation/master/schema/cloudformation\.schema\.json": "/*"
}
from yaml-language-server.
Interestingly enough the json language server does not run into this issue (although they use a slightly different way of configuring their schemas)
from yaml-language-server.
So then for the json language server, and then json schema this works.......would rule out neovim, yes?
from yaml-language-server.
No, the problem is whatever is sending the requests to the language server is messing up the URL in the workspace/didChangeConfiguration request. JSON language server has a different way of setting up the schemas that doesn't trigger the errors. Actually now that I think about it, I think whats causing the issue is that they're splitting yaml.schemas and then splitting everything with a period after that so it results in the split up URL below, instead of preserving it.
from yaml-language-server.
Related Issues (20)
- Proposal for Donating the yaml-language-server Project to an Open Governance Foundation HOT 5
- Show enum values on hover HOT 1
- Github workflow deploy.yml detected as a PHP Deployer config HOT 1
- docs: The examples in the README have their syntax set wrong
- YAML `---` for "Multiple documents within a single stream" doesn't work [YAML Language Server] HOT 2
- Cannot Load content for: schema.json Unknown schema: file
- URL fragment references does not resolve correctly
- Use inline JSON Schema w/o modeline - make `yaml-language-server` string optional
- Hover: Show root property title and description when using anyOf untitled un-described types HOT 1
- Schema association with fallbacks (wildcards) HOT 1
- Is there tilde expanstion feature on the horizon (or already supported) in schemas paths?
- yamlls + schema working fine in neovim? HOT 1
- openshift schemas in nvim with yamlls
- Add support for specifying schema via `# $schema: …`
- RFC: Support schema from a child definition HOT 1
- How to configure yamlls at a workspace level for neovim?
- Use schema from `"$schema":` for current JSON file HOT 2
- Is path auto completion for $ref not supported?
- Unable to associate schemastore schema with a file path (nvim) HOT 1
- GitlabCI Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml-language-server.