withfig / autocomplete

IDE-style autocomplete for your existing terminal & shell
https://fig.io
MIT License
24.58k stars 5.49k forks source link

[swiftc] Add completion spec #537

Open 0xifarouk opened 3 years ago

0xifarouk commented 3 years ago

Sanity checks

What CLI tool does this relate to?

swiftc

Which statement makes the most sense?

This completion spec does not exist

Issue Details

Add support for the Swift compiler.

HarryET commented 3 years ago

Hi! I can have a look into this if it hasn't already been done?

0xifarouk commented 3 years ago

@HarryET Yes, nothing has been done yet. You can check /src directory there still no swiftc.ts file. Also there is no pull request to add it.

HarryET commented 3 years ago

Okay, I'll try do it then. Looks likes there is loads of args to add for swift/swiftc :)

0xifarouk commented 3 years ago

Yeah, do you have an idea of where I can a list of all commands and arguments for it?

HarryET commented 3 years ago

Yeah, do you have an idea of where I can a list of all commands and arguments for it?

I've just done swiftc --help

HarryET commented 3 years ago

If you wanted to have a go instead I don't mind?

0xifarouk commented 3 years ago

Yeah, do you have an idea of where I can a list of all commands and arguments for it?

I've just done swiftc --help

Yeah I know about this, I was wondering if there is a webpage that lists all of them at once.

0xifarouk commented 3 years ago

If you wanted to have a go instead I don't mind?

No no, just go ahead 😅 I have just finished adding auto completion for another tool and I feel very tired.

fedeci commented 3 years ago

@HarryET Good luck 😄

dlbuckley commented 2 years ago

I've opened a PR for adding support for the swift compiler here: https://github.com/withfig/autocomplete/pull/814

clo4 commented 2 years ago

For swiftc:

OVERVIEW: Swift compiler

USAGE: swiftc

MODES:
  -dump-ast               Parse and type-check input file(s) and dump AST(s)
  -dump-parse             Parse input file(s) and dump AST(s)
  -dump-pcm               Dump debugging information about a precompiled Clang module
  -dump-scope-maps <expanded-or-list-of-line:column>
                          Parse and type-check input file(s) and dump the scope map(s)
  -dump-type-info         Output YAML dump of fixed-size types from all imported modules
  -dump-type-refinement-contexts
                          Type-check input file(s) and dump type refinement contexts(s)
  -emit-assembly          Emit assembly file(s) (-S)
  -emit-bc                Emit LLVM BC file(s)
  -emit-executable        Emit a linked executable
  -emit-imported-modules  Emit a list of the imported modules
  -emit-irgen             Emit LLVM IR file(s) before LLVM optimizations
  -emit-ir                Emit LLVM IR file(s) after LLVM optimizations
  -emit-library           Emit a linked library
  -emit-object            Emit object file(s) (-c)
  -emit-pcm               Emit a precompiled Clang module from a module map
  -emit-sibgen            Emit serialized AST + raw SIL file(s)
  -emit-sib               Emit serialized AST + canonical SIL file(s)
  -emit-silgen            Emit raw SIL file(s)
  -emit-sil               Emit canonical SIL file(s)
  -emit-supported-features
                          Emit a JSON file including all supported compiler features
  -index-file             Produce index data for a source file
  -parse                  Parse input file(s)
  -print-ast-decl         Parse and type-check input file(s) and pretty print declarations from AST(s)
  -print-ast              Parse and type-check input file(s) and pretty print AST(s)
  -resolve-imports        Parse and resolve imports in input file(s)
  -scan-dependencies      Scan dependencies of the given Swift sources
  -typecheck              Parse and type-check input file(s)

OPTIONS:
  -access-notes-path <value>
                          Specify YAML file to override attributes on Swift declarations in this module
  -api-diff-data-dir <path>
                          Load platform and version specific API migration data files from <path>. Ignored if -api-diff-data-file is specified.
  -api-diff-data-file <path>
                          API migration data is from <path>
  -application-extension  Restrict code to those available for App Extensions
  -assert-config <value>  Specify the assert_configuration replacement. Possible values are Debug, Release, Unchecked, DisableReplacement.
  -async-main             Resolve main function as if it were called from an asynchronous context
  -avoid-emit-module-source-info
                          don't emit Swift source info file
  -clang-target <value>   Separately set the target we should use for internal Clang instance
  -color-diagnostics      Print diagnostics in color
  -continue-building-after-errors
                          Continue building, even after errors are encountered
  -coverage-prefix-map <prefix=replacement>
                          Remap source paths in coverage info
  -debug-info-format=<value>
                          Specify the debug info format type to either 'dwarf' or 'codeview'
  -debug-info-store-invocation
                          Emit the compiler invocation in the debug info.
  -debug-prefix-map <prefix=replacement>
                          Remap source paths in debug info
  -define-availability <macro>
                          Define an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'
  -diagnostic-style <style>
                          The formatting style used when printing diagnostics ('swift' or 'llvm')
  -disable-actor-data-race-checks
                          Disable runtime checks for actor data races
  -disable-autolinking-runtime-compatibility-concurrency
                          Do not use autolinking for the concurrency runtime compatibility library
  -disable-autolinking-runtime-compatibility-dynamic-replacements
                          Do not use autolinking for the dynamic replacement runtime compatibility library
  -disable-autolinking-runtime-compatibility
                          Do not use autolinking for runtime compatibility libraries
  -disable-clang-target   Disable a separately specified target triple for Clang instance to use
  -disable-incremental-imports
                          Disable cross-module incremental build metadata and driver scheduling for Swift modules
  -disable-migrator-fixits
                          Disable the Migrator phase which automatically applies fix-its
  -disable-only-one-dependency-file
                          Disables incremental build optimization that only produces one dependencies file
  -disallow-use-new-driver
                          Disable using new swift-driver
  -driver-time-compilation
                          Prints the total time it took to execute all compilation tasks
  -dump-migration-states-dir <path>
                          Dump the input text, output text, and states for migration to <path>
  -dump-usr               Dump USR for each declaration reference
  -D <value>              Marks a conditional compilation flag as true
  -embed-bitcode-marker   Embed placeholder LLVM IR data as a marker
  -embed-bitcode          Embed LLVM IR bitcode as data
  -embed-tbd-for-module <value>
                          Embed symbols from the module in the emitted tbd file
  -emit-dependencies      Emit basic Make-compatible dependencies files
  -emit-loaded-module-trace-path <path>
                          Emit the loaded module trace JSON to <path>
  -emit-loaded-module-trace
                          Emit a JSON file containing information about what modules were loaded
  -emit-module-interface-path <path>
                          Output module interface file to <path>
  -emit-module-interface  Output module interface file
  -emit-module-path <path>
                          Emit an importable module to <path>
  -emit-module-source-info-path <path>
                          Output module source info file to <path>
  -emit-module-summary-path <path>
                          Output module summary file to <path>
  -emit-module-summary    Output module summary file
  -emit-module            Emit an importable module
  -emit-objc-header-path <path>
                          Emit an Objective-C header file to <path>
  -emit-objc-header       Emit an Objective-C header file
  -emit-tbd-path <path>   Emit the TBD file to <path>
  -emit-tbd               Emit a TBD file
  -enable-actor-data-race-checks
                          Emit runtime checks for actor data races
  -enable-bare-slash-regex
                          Enable the use of forward slash regular-expression literal syntax
  -enable-experimental-additive-arithmetic-derivation
                          Enable experimental 'AdditiveArithmetic' derived conformances
  -enable-experimental-concise-pound-file
                          Enable experimental concise '#file' identifier
  -enable-experimental-cxx-interop
                          Allow importing C++ modules into Swift (experimental feature)
  -enable-experimental-forward-mode-differentiation
                          Enable experimental forward mode differentiation
  -enable-incremental-imports
                          Enable cross-module incremental build metadata and driver scheduling for Swift modules
  -enable-library-evolution
                          Build the module to allow binary-compatible library evolution
  -enable-only-one-dependency-file
                          Enables incremental build optimization that only produces one dependencies file
  -enforce-exclusivity=<enforcement>
                          Enforce law of exclusivity
  -experimental-cxx-stdlib <value>
                          C++ standard library to use; forwarded to Clang's -stdlib flag
  -file-compilation-dir <path>
                          The compilation directory to embed in the debug info. Coverage mapping is not supported yet.
  -file-prefix-map <prefix=replacement>
                          Remap source paths in debug, coverage, and index info
  -fixit-all              Apply all fixits from diagnostics without any filtering
  -framework <value>      Specifies a framework which should be linked against
  -Fsystem <value>        Add directory to system framework search path
  -F <value>              Add directory to framework search path
  -gdwarf-types           Emit full DWARF type info.
  -gline-tables-only      Emit minimal debug info for backtraces only
  -gnone                  Don't emit debug info
  -g                      Emit debug info. This is the preferred setting for debugging with LLDB.
  -help                   Display available options
  -import-underlying-module
                          Implicitly imports the Objective-C half of a module
  -index-file-path <path> Produce index data for file <path>
  -index-ignore-clang-modules
                          Avoid indexing clang modules (pcms)
  -index-ignore-system-modules
                          Avoid indexing system modules
  -index-store-path <path>
                          Store indexing data to <path>
  -index-unit-output-path <path>
                          Use <path> as the output path in the produced index data.
  -I <value>              Add directory to the import search path
  -j <n>                  Number of commands to execute in parallel
  -libc <value>           libc runtime library to use
  -locale <locale-code>   Choose a language for diagnostic messages
  -localization-path <path>
                          Path to localized diagnostic messages directory
  -lto-library <lto-library>
                          Perform LTO with <lto-library>
  -lto=<value>            Specify the LTO type to either 'llvm-thin' or 'llvm-full'
  -L <value>              Add directory to library link search path
  -l <value>              Specifies a library which should be linked against
  -migrate-keep-objc-visibility
                          When migrating, add '@objc' to declarations that would've been implicitly visible in Swift 3
  -migrator-update-sdk    Does nothing. Temporary compatibility flag for Xcode.
  -migrator-update-swift  Does nothing. Temporary compatibility flag for Xcode.
  -module-abi-name <value>
                          ABI name to use for the contents of this module
  -module-alias <alias_name=underlying_name>
                          If a source file imports or references module <alias_name>, the <underlying_name> is used for the contents of the file
  -module-cache-path <value>
                          Specifies the Clang module cache path
  -module-link-name <value>
                          Library to link against when using this module
  -module-name <value>    Name of the module to build
  -no-color-diagnostics   Do not print diagnostics in color
  -no-verify-emitted-module-interface
                          Don't check that module interfaces emitted during compilation typecheck
  -no-warnings-as-errors  Don't treat warnings as errors
  -no-whole-module-optimization
                          Disable optimizing input files together instead of individually
  -nostdimport            Don't search the standard library import path for modules
  -num-threads <n>        Enable multi-threading and specify number of threads
  -Onone                  Compile without any optimization
  -Osize                  Compile with optimizations and target small code size
  -Ounchecked             Compile with optimizations and remove runtime safety checks
  -output-file-map <path> A file which specifies the location of outputs
  -O                      Compile with optimizations
  -o <file>               Write output to <file>
  -parse-as-library       Parse the input file(s) as libraries, not scripts
  -parse-sil              Parse the input file as SIL code, not Swift source
  -parseable-output       Emit textual output in a parseable format
  -prefix-serialized-debugging-options
                          Apply debug prefix mappings to serialized debug info in Swiftmodule files
  -pretty-print           Pretty-print the output JSON
  -print-educational-notes
                          Include educational notes in printed diagnostic output, if available
  -print-target-info      Print target information for the given target <triple>, such as x86_64-apple-macos10.9
  -profile-coverage-mapping
                          Generate coverage data for use with profiled execution counts
  -profile-generate       Generate instrumented code to collect execution counts
  -profile-use=<profdata> Supply a profdata file to enable profile-guided optimization
  -Rcross-import          Emit a remark if a cross-import of a module is triggered.
  -remove-runtime-asserts Remove runtime safety checks.
  -require-explicit-availability-target <target>
                          Suggest fix-its adding @available(<target>, *) to public declarations without availability
  -require-explicit-availability
                          Require explicit availability on public declarations
  -require-explicit-sendable
                          Require explicit Sendable annotations on public declarations
  -requirement-machine-abstract-signatures=<value>
                          Control usage of experimental generic signature minimization: 'on', 'off', 'verify' or 'check'
  -requirement-machine-inferred-signatures=<value>
                          Control usage of experimental generic signature minimization: 'on', 'off', 'verify' or 'check'
  -requirement-machine-protocol-signatures=<value>
                          Control usage of experimental protocol requirement signature minimization: 'on', 'off', 'verify' or 'check'
  -Rmodule-loading        Emit a remark and file path of each loaded module
  -Rpass-missed=<value>   Report missed transformations by optimization passes whose name matches the given POSIX regular expression
  -Rpass=<value>          Report performed transformations by optimization passes whose name matches the given POSIX regular expression
  -runtime-compatibility-version <value>
                          Link compatibility library for Swift runtime version, or 'none'
  -sanitize-coverage=<type>
                          Specify the type of coverage instrumentation for Sanitizers and additional options separated by commas
  -sanitize-recover=<check>
                          Specify which sanitizer runtime checks (see -sanitize=) will generate instrumentation that allows error recovery. Listed checks should be comma separated. Default behavior is to not allow error recovery.
  -sanitize=<check>       Turn on runtime checks for erroneous behavior.
  -save-optimization-record-passes <regex>
                          Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)
  -save-optimization-record-path <value>
                          Specify the file name of any generated optimization record
  -save-optimization-record=<format>
                          Generate an optimization record file in a specific format (default: YAML)
  -save-optimization-record
                          Generate a YAML optimization record file
  -save-temps             Save intermediate compilation results
  -sdk <sdk>              Compile against <sdk>
  -serialize-diagnostics  Serialize diagnostics in a binary format
  -static-executable      Statically link the executable
  -static-stdlib          Statically link the Swift standard library
  -static                 Make this module statically linkable and make the output of -emit-library a static library.
  -strict-concurrency=<value>
                          Specify the how strict concurrency checking will be. The value may be 'minimal' (most 'Sendable' checking is disabled), 'targeted' ('Sendable' checking is enabled in code that uses the concurrency model, or 'complete' ('Sendable' and other checking is enabled for all code in the module)
  -suppress-warnings      Suppress all warnings
  -swift-isa-ptrauth-mode <mode>
                          Mode for staging isa/super signing. Supported modes are LegacyAndStrip, NewAndStrip and NewAndAuth.
  -swift-ptrauth-mode <mode>
                          Mode for staging pointer authentication. Supported modes are LegacyAndStrip, NewAndStrip and NewAndAuth.
  -swift-version <vers>   Interpret input according to a specific Swift language version number
  -target-cpu <value>     Generate code for a particular CPU variant
  -target-min-inlining-version <value>
                          Require inlinable code with no '@available' attribute to back-deploy to this version of the '-target' OS
  -target-variant <value> Generate 'zippered' code for macCatalyst that can run on the specified variant target triple in addition to the main -target triple
  -target <triple>        Generate code for the given target <triple>, such as x86_64-apple-macos10.9
  -tools-directory <directory>
                          Look for external executables (ld, clang, binutils) in <directory>
  -track-system-dependencies
                          Track system dependencies while emitting Make-style dependencies
  -use-ld=<value>         Specifies the linker to be used
  -user-module-version <vers>
                          Module version specified from Swift module authors
  -verify-debug-info      Verify the binary representation of debug output.
  -verify-emitted-module-interface
                          Check that module interfaces emitted during compilation typecheck
  -version                Print version information and exit
  -vfsoverlay <value>     Add directory to VFS overlay file
  -v                      Show commands to run and use verbose output
  -warn-concurrency       Warn about code that is unsafe according to the Swift Concurrency model and will become ill-formed in a future language version
  -warn-implicit-overrides
                          Warn about implicit overrides of protocol members
  -warn-swift3-objc-inference-complete
                          Warn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4
  -warn-swift3-objc-inference-minimal
                          Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint
  -warnings-as-errors     Treat warnings as errors
  -whole-module-optimization
                          Optimize input files together instead of individually
  -working-directory <path>
                          Resolve file paths relative to the specified directory
  -Xcc <arg>              Pass <arg> to the C/C++/Objective-C compiler
  -Xlinker <value>        Specifies an option which should be passed to the linker
  -emit-digester-baseline Emit a baseline file for the module using the API digester
  -emit-digester-baseline-path <path>
                          Emit a baseline file for the module to <path> using the API digester
  -compare-to-baseline-path <path>
                          Compare the built module to the baseline at <path> and diagnose breaking changes using the API digester
  -serialize-breaking-changes-path <path>
                          Serialize breaking changes found by the API digester to <path>
  -digester-breakage-allowlist-path <path>
                          The path to a list of permitted breaking changes the API digester should ignore
  -digester-mode <api|abi>
                          Whether the API digester should run in API or ABI mode (defaults to API checking)

Will take this on. Seems easy enough with something like helix