Skip to content

Corrupt syntax when saving #10

@confact

Description

@confact

Zed Version: 0.172.11
Extension: v0.0.2
Crystal: 1.13.1

When I save a simple crystal file:

module Gitcr
  class Branch
    getter name : String
    getter repository : Repository
    getter sha : String
    
    def initialize(repository : Repository, name : String, sha : String)
      raise "Invalid branch name" unless name.size > 0
      @repository = repository
      @name = name.starts_with?("refs/heads/") ? name : "refs/heads/#{name}"
      @sha = sha
    end
  end
end

It get saved as:

module Gitcr
  class Branch
  end
end
    def initialize(repository : Repository, name : String, sha : String)
      raise "Invalid branch name" unless name.size > 0
      @repository = repository
      @name = name.starts_with?("refs/heads/") ? name : "refs/heads/#{name}"
      @sha = sha
    end
  end
end

Is this a known issue, and if so, is there any workaround?

UPDATE:
I did a workaround with:

"Crystal": {
      "format_on_save": "off"
    }

in the settings in languages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions