v4 / doc / codelite.md
94 lines · 62 sloc · 2.92 KB · f31347a525c95202358dca4c38c887e7b891b807
Raw

CodeLite Setup

CodeLite works well with V when you open the code as a File System Workspace and define custom build targets with CodeLite macros.

This guide uses POSIX shell commands, which match Linux and macOS. On Windows, use .exe outputs and replace rm -f with del.

Prerequisites

Open the workspace settings by right-clicking the top-level folder and choosing Settings....

General Settings

Set these fields first:

CodeLite uses the selected tool chain mainly to parse build output, so any GNU-like tool chain is fine here.

For single-file programs, use:

For a project rooted at the workspace folder, use:

Build Targets

The default build and clean targets can not be removed. Add run and test targets if you want them in the Build menu.

Build the current file

This is the simplest setup for scripts, examples, and small programs:

Build the whole workspace

If the workspace root is a V project with v.mod, or the workspace folder is your app entry point, use:

If your app starts from a specific file such as src/main.v, replace "$(WorkspacePath)" with that file path in the build target.

Running and Debugging

Better Compiler Errors in the IDE

If CodeLite opens the wrong file from compiler errors, add this workspace environment variable:

That makes v print absolute file paths, which is often better for IDE launchers.

Formatting and Language Features

For manual formatting, or for a formatter command inside CodeLite, use:

For completion, go-to-definition, hover information, and related IDE features, use v-analyzer alongside CodeLite.