-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't like AWS CloudFormation templates #20
Comments
This is available in 0.0.7 of the language server! |
@JPinkney YOU, SIR... are a hero. |
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! |
Bump. I was wanting to know if there is a setting I have to do |
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 or yaml.customTags: [ (it defaults the type to scalar so you don't have to specify the scalar for the property) |
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? |
I have something like this set up:
But I am still getting this error: https://i.imgur.com/gj32GKq.png |
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! |
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:
And I still have the same error of: I am happy to say that the format settings, validate settings and completion works. |
Thanks for your reply. I am wondering if it could be a result of using a different client? Right now I am using: And my entire set up looks like this:
|
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) |
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? |
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? |
I will see if I can make that happen. |
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:
Now it works. :D My second question now is regarding the schemas, I have added the schema's as per: 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? |
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
and tell me if it errors
Yes, depending on how well built the schemas are |
Yup, I have reactivated them:
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: |
The /* is just telling the schema to map to all yaml files.
By flag do you mean
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? |
Sure thing, let me show you: Here is a picture of my vim with this. And the corresponding config is in my previous post, I haven't changed anything. |
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):
|
What would happen if in the first picture you add dots to the broken down url, like: "schemas": { The URL definitely does look mangled. So is this a behavior of coc? |
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.
|
Interestingly enough the json language server does not run into this issue (although they use a slightly different way of configuring their schemas) |
So then for the json language server, and then json schema this works.......would rule out neovim, yes? |
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. |
I understand the CloudFormation format is a bit non-standard, but it would at least be nice to have an option in this extension to disable syntax-checking. I mostly want it since it adds the YAML structure to the Code Outline extension.
The text was updated successfully, but these errors were encountered: