Error in backend: invalid llvm.linker.options building SourceKit-LSP on Ubuntu 18.10
This is an llvm bug (https://bugs.llvm.org/show_bug.cgi?id=39743). See workaround here: https://forums.swift.org/t/error-while-trying-to-build-sourcekit-lsp-on-linux/18138/2
XcodeKit and SourceKit
Depending on your end goal, you have a few options:
SwiftSyntax
is a new (beta) open-source framework from Apple for walking through/modifying a document’s AST (abstract syntax tree). More information & an example are available on the GitHub repository.As mentioned,
SourceKitten
is a Swift library for communicating withSourceKit
.SourceKit
is the backbone of Xcode, which is really just a glorified text editor without it. It provides everything from semantically-analyzed substructures and generated interfaces to code-completion and syntax highlighting—everything an IDE needs. It is the most encompassing option and it's not going anywhere anytime soon (as Maxim mentioned, Apple's even developing a LSP interface for it.) Shameless plug: I’ve further developedSylvester
, a typed, XPC-availableSourceKitten
(SourceKit
) interface with some sugar. TheSKEditorOpen
request should provide you with enough information to extract whatever you want from a source document.XcodeKit
exposes an extremely limited API to interacting with the source code. In fact, it only provides a mutable buffer of the open document in the editor that the user invoked the command from.
As for your inquiry on retrieving the currently open documents in the editor, your only option would be to use the wonderful scripting interface that Xcode exposes. The Xcode SDEF file can be found at /Applications/Xcode.app/Contents/Resources/Xcode.sdef. You can use the ScriptingBridge
framework to do so from a Cocoa application. If you're using Swift, then the SwiftScripting
repository is crucially helpful.
Related Topics
Invalid Choice: 'Kernel_Add_Dts' in Yocto Build
How to Overwrite Linux System Files into The Yocto Filesystem
Make Uses "Cc" Instead of "Arm-None-Eabi-As"
Behavior of Writing to Tcp Socket Before Reading All Data
Counting Lines Starting with a Certain Word
Influxdb Not Asking for Authentication
Host Multiple ASP.NET Core Web Application Under a Single Linux Server
Linux Shell Scripting: How to Remove Final Numbers in a Word List File
Yocto for Nvidia Jetson Fails Because of Gcc 7 - Cannot Compute Suffix of Object Files
Ftrace: System Crash When Changing Current_Tracer from Function_Graph via Echo
./Configure-With-Boost No Such File or Directory
How to Get The Process Id of Command Executed in Bash Script
Complete Password Field Scp Command on Linux
Bash Script Commands Not Working in Cron
Unanticipated Segmentation Fault in C