Skip to content

Commit

Permalink
Apply DeMorgan's Law
Browse files Browse the repository at this point in the history
created `ApplyDeMorganLaw` to provide code actions for generalised DeMorgan's conversion
- matches with the outermost applicable expression
- supports both logical and bitwise expressions
- parentheses are created minimally
added SwiftOperators from swift-syntax as a new dependency to SourceKitLSP
registered in `SyntaxCodeActions.allSyntaxCodeActions`
registered in Sources/SourceKitLSP/CMakeLists.txt
added tests in `CodeActionTests`
  • Loading branch information
AppAppWorks committed Jul 3, 2024
1 parent 607292a commit 18935ab
Show file tree
Hide file tree
Showing 5 changed files with 641 additions and 0 deletions.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ let package = Package(
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
.product(name: "SwiftIDEUtils", package: "swift-syntax"),
.product(name: "SwiftOperators", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftParserDiagnostics", package: "swift-syntax"),
.product(name: "SwiftRefactor", package: "swift-syntax"),
Expand Down
1 change: 1 addition & 0 deletions Sources/SourceKitLSP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ target_sources(SourceKitLSP PRIVATE
target_sources(SourceKitLSP PRIVATE
Swift/AdjustPositionToStartOfIdentifier.swift
Swift/CodeActions/AddDocumentation.swift
Swift/CodeActions/ApplyDeMorganLaw.swift
Swift/CodeActions/ConvertIntegerLiteral.swift
Swift/CodeActions/ConvertJSONToCodableStruct.swift
Swift/CodeActions/PackageManifestEdits.swift
Expand Down
Loading

0 comments on commit 18935ab

Please sign in to comment.