Skip to content
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

IDEA does not fully recognise SAM template not named template.yaml #2446

Closed
middlewareman opened this issue Feb 18, 2021 · 4 comments
Closed
Labels
guidance General information and guidance, answers to FAQs, or recommended best practices/resources.

Comments

@middlewareman
Copy link

Describe the bug
I would like to name my SAM template sam.yaml instead of the default template.yaml,
but then syntax highlighting fails for the Globals section.

To reproduce

  1. Create a trivial project with template.yaml as follows:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  Generated by sam init

# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
  Function:
    Timeout: 20

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
    Properties:
      CodeUri: HelloWorldFunction
      Handler: helloworld.App::handleRequest
      Runtime: java11
      MemorySize: 512
      Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
        Variables:
          PARAM1: VALUE
      Events:
        HelloWorld:
          Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
          Properties:
            Path: /hello
            Method: get

It will look fine in the editor.
2. Rename it to sam.yaml.
Syntax highlighting now fires up on the Globals section:

Schema validation: Property 'Globals' is not allowed

Expected behavior
IDEA should continue to recognise it as a SAM template (from its initial lines).
(This would also cover the case of other files named template.yaml that are not SAM templates.)

Your Environment
IntelliJ IDEA 2020.3.2 (Ultimate Edition)
Build #IU-203.7148.57, built on January 26, 2021
Licensed to Andreas Nyberg
You have a perpetual fallback license for this version.
Subscription is active until January 2, 2022.
Runtime version: 11.0.9.1+11-b1145.77 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 8
Registry: debugger.watches.in.variables=false, scala.erase.compiler.process.jdk.once=false
Non-Bundled Plugins: Batch Scripts Support, main.kotlin.com.jimschubert.intellij.swaggercodegen, open-liberty.intellij, SpotProfiler, com.crownpartners.intellivault, com.thesamet.intellij.ScariformFormat, ru.artyushov, soapUI Plugin, org.jetbrains.plugins.hocon, Jetbrains TeamCity Plugin, org.jfrog.idea, com.intellij.plugin.adernov.powershell, com.dmarcotte.handlebars, aws.toolkit, org.jetbrains.kotlin, org.mapstruct.intellij, JProfiler, org.intellij.scala

@middlewareman middlewareman added the bug We can reproduce the issue and confirmed it is a bug. label Feb 18, 2021
@hunterwerlla
Copy link
Contributor

Syntax highlighting for SAM templates is actually done by Intellij itself:
Screen Shot 2021-02-18 at 8 25 40 AM
(down in the bottom left corner). If there is an issue with the schema, they seem to come from SchemaStore.org. We are planning on improving the plugin support to improve this experiences (See issue #2183 for an example of things we want to improve), but we currently do not do anything with syntax highlighting or code completion.

@hunterwerlla hunterwerlla added guidance General information and guidance, answers to FAQs, or recommended best practices/resources. and removed bug We can reproduce the issue and confirmed it is a bug. labels Feb 18, 2021
@es50678
Copy link

es50678 commented Mar 8, 2021

Ran into this today, there looks to be a issue in the repo responsible for the schema that is used in the IDE.

awslabs/goformation#305

@hauntingEcho
Copy link

I ran into this too, and opened a PR to schemastore that should fix it: SchemaStore/schemastore#1536

@rli
Copy link
Contributor

rli commented Aug 17, 2022

Closing as this is not an issue with the toolkit

@rli rli closed this as completed Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance General information and guidance, answers to FAQs, or recommended best practices/resources.
Projects
None yet
Development

No branches or pull requests

5 participants