Skip to content

Indentation problem #32

@dabrahams

Description

@dabrahams

If I attempt to indent-region in code whose syntax I've broken (say, by deleting a necessary closing brace), it fails like this:

lsp-request: Running swift-format failed
<unknown>: warning: Running swift-format without input paths is deprecated and will be removed in the future.

Please update your invocation to do either of the following:

- Pass ‘-‘ to read from stdin (e.g., ‘cat MyFile.swift | swift-format -‘).
- Pass one or more paths to Swift source files or directories containing
  Swift source files. When passing directories, make sure to include the
  ‘--recursive‘ flag.

For more information, use the ‘--help‘ option.
/Users/dave/src/hylo/<stdin>:3815:2: error: expected ’}’ to end struct

If I set lsp-enable-indentation to nil and reopen the buffer, it works using swift-mode's indentation, which is more resilient. If sourcekit-lsp could make indentation fall back to using the mode when swift-format fails, that would be awesome.

Since swift-format doesn't seem capable of ignoring errors, and indentation seems(?) to be provided directly by SourceKit through some kind of textDocument/rangeFormatting request, this might be considered a SourceKit bug. Please advise.

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