Skip to content

Codeface Documentation

Marcel Becker edited this page Nov 20, 2023 · 7 revisions

⚠️ This page is still new and continuously growing. Latest update: August 13, 2023

General Questions

πŸ“• What If I Don't Want to Read an FAQ?

You can always write at hello@codeface.io to get personal support.

πŸ“• What Does Codeface Do Exactly?

Have a look at this showcase.

πŸ“• How Can I Try It Out Quickly?

Install Codeface from the Mac App Store. Then download and open one of theses files.

Language Support Via LSP and LSPService

πŸ“• Why Do I Not See Any Arrows?

To see dependency arrows and symbols, Codeface must talk to LSPService while importing a code folder. LSPService is a free open-source webservice that you can download and run on your machine. It can launch LSP servers and thereby provide Codeface detailed information about codebases of virtually all languages.

This tutorial describes how to setup and use LSPService.

Note that automatic Swift support only works for Swift packages, since Apple's LSP server does not support Xcode projects.

In following sections, you find more infos on support for Swift (Apple platforms), Dart (Flutter) and Kotlin (Android and KMP).

πŸ“• How Does LSPService Work?

Have a look at this tutorial.

πŸ“• Why Do I Even Need LSPService? That's Cumbersome!

And indeed it is more cumbersome than we would have liked. Because of the App Store rules, it took a lot of work to make Codeface available in the App Store at all without losing its ability to leverage LSP servers. Another recent attempt to replace LSPService by an integrated XPC service also failed.

However, we're working on making LSP server integration easier on multiple fronts. For example, 1) LSPService will be signed, so its installation becomes smoother and 2) You'll be able to configure LSPService via a graphical interface from within Codeface. Because of these efforts, significant new features are currently all on hold.

πŸ“• Why Does The Code Import Take So Long?

When using an LSP server, importing larger codebases does indeed take long because requests to LSP servers can not generally be made in parallel.

You can accelerate loading a codebase visualization again by saving it to a .codebase file. Such a file stores a whole codebase, including all the data retrieved from an LSP server. Loading a codebase from file is much faster. So when you don't need to update the visualization, you can open it in Codeface without waiting for the LSP server.

Language Support For Swift (Apple Platforms)

πŸ“• How Do I Setup the Swift LSP Server?

If Xcode is installed, LSPService automatically finds Apple's LSP server (SourceKit-LSP), which supports Swift code. Using it with Swift code, you have to be aware of a few things:

  • SourceKit-LSP supports Swift Packages but not Xcode projects.

  • To update what SourceKit-LSP can "see", you have to swift build the package from the terminal before importing it into a Codeface file. This is due to a caveat of SourceKit-LSP, which is still at an early stage. If the package contains a test target, you also need to build test, for instance via swift test, to see the dependencies originating from the tests.

  • Sometimes, deleting the hidden ".build" folder within the package before building it helps to update everything. You can show and hide hidden files on macOS via shift + ⌘ + . (Shift + Command + Dot).

The same LSP server from Apple should also work for Objective-c, C++ and C.

πŸ“• Why Can I Not Visualize My Xcode Project?

Codeface can import any code folder. But it can not open, import or otherwise know anything about Xcode projects. This is because Apple's LSP server does not support Xcode projects but only Swift packages.

We suspect that Apple's LSP server will never support Xcode projects but that instead the Swift Package Manager might some day support app targets and thereby more or less replace Xcode project files.

If your code is in an Xcode project, you can use a little "trick" to visualize it: Extract as much of it as possible into one or multiple local Swift packages. Many developers do that anyway to speed up compiles and to manifest/enforce architectural boundaries.

πŸ“• Why Is My Swift Package Not Visualized Correctly?

As described above, you have to swift build the package from the terminal before importing it into a .codebase file. This will update what Apple's LSP server can "see" during the import.

Sometimes, it's also necessary to delete the hidden ".build" folder inside the package folder before building the package. You can show and hide hidden files on macOS via shift + ⌘ + . (Shift + Command + Dot).

Language Support for Dart (Flutter)

πŸ“• How Do I Setup the Dart LSP Server?

Dart includes an official Dart language server. When Dart is installed (possibly as part of Flutter), you should be able to launch its language server via dart language-server. It seems the client id and -version arguments are not required.

When adding an entry for Dart into the LSPServiceConfig.json file, you need to provide the full path to Dart. You can determine that path via the shell command which dart. The entry may then look something like this:

"dart" : {
    "path" : "/Users/seb/Desktop/flutter/bin/dart",
    "arguments" : [
        "language-server"
    ],
    "environment" : {}
}

As with most languages, it is important to build a Dart-/Flutter project before importing it into Codeface.

Language Support For Kotlin (Android and KMP)

πŸ“• How Do I Setup the Kotlin LSP Server?

Install the Kotlin Language Server (KLS) via Homebrew: brew install kotlin-language-server

The default LSPServiceConfig.json file (generated by LSPService when the file doesn't exist) already contains the path of KLS, given that KLS was installed via Homebrew. The entry should look something like this:

"kotlin" : {
    "path" : "/opt/homebrew/bin/kotlin-language-server",
    "arguments" : [

    ],
    "environment" : {
    
    }
}

As with most languages, it is important to build a Kotlin project before importing it into Codeface.

Language Support for Python

πŸ“• How Do I Set Up the Python LSP Server?

There are some Python LSP servers. One currently working is jedi-language-server. python-lsp-server and pyright are not working with the LSPService.

You can install jedi-language-server using pip: pip install jedi-language-server. Installing it inside a virtual environment does work too.

Add the following entry to the LSPServiceConfig.json file. Find the path using which jedi-language-server (activate virtual environment before).

{
  "python" : {
    "path" : "/.../.env/bin/jedi-language-server",
    "arguments" : [],
    "environment" : {}
  }
}

As with most languages, it is important to build a Python project before importing it into Codeface.