mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
#481 replaced SourceKit placeholders (like `<#code#>`) by LSP snippets for code actions, which are used to represent SourceKit refactoring and diagnostic Fix-Its. But LSP snippets are only supported for code completion, not for code actions. This results in LSP snippets like ${1:code} being inserted into the editor. Instead of replacing SourceKit placeholders by LSP placeholders, we should just remove them altogether from the code action response. rdar://92447079 [#488]
20 lines
784 B
Swift
20 lines
784 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
public extension String {
|
|
// This implementation is really slow; to use it outside a test it should be optimized.
|
|
func trimmingTrailingWhitespace() -> String {
|
|
return self.replacingOccurrences(of: "[ ]+\\n", with: "\n", options: .regularExpression)
|
|
}
|
|
}
|