Docs contents

Types and completion in VS Code

Contents · Setup · Extension installation and settings

Install the VS Code extension from the Marketplace or a VSIX on GitHub Releases. Nagi for IntelliJ IDEA and PyCharm can be installed directly from JetBrains Marketplace in a compatible IDE. Check the listing's Versions view for available versions and compatible IDE builds. GitHub Releases provides the published 0.1.2 common ZIP for IDEA and PyCharm, which can be installed manually. See the setup guide for the current asset names.

The published 0.1.2 common ZIP on GitHub Releases targets IntelliJ IDEA 2025.1.1 build 251.25410.109 or later and PyCharm 2025.1.1 build 251.25410.122 or later. The public API used by the 0.1.2 trust check is unavailable in the initial 2025.1 builds, so those builds are outside this ZIP's support range. Users on 2024.3 or an initial 2025.1 build can keep their installed version or upgrade the IDE before installing the 0.1.2 ZIP. For Marketplace installs, check the Versions view for the IDE builds supported by the selected version.

The unreleased 0.1.3 candidate provides High/Low completion, diagnostics, limited go-to-definition, and an IDE-standard Run Configuration. The plugin's High/Low syntax highlighting does not require a compiler; published nagic 0.1.11 continues to support manual Check/Run and normal execution through the standard Run Configuration. The 0.1.3 plugin candidate can use Nagi 0.2.0 for semantic assistance. Published 0.1.11 does not provide the assist protocol. Analysis is partial, cannot prove a full build succeeds, and reports only the first compiler error. In a project, the source must belong to the entry's import/native graph. Assistance stops while nagi.toml has unsaved changes and cannot navigate references without an exact source span. The candidate is not a GitHub Release or Marketplace release; its plugin ZIP is a PR validation artifact; compiler 0.2.0 is publicly released. See the JetBrains guide for the current constraints.

The JetBrains candidate also includes standard-setting-aware brace and quote pairing, bounded Enter indentation, and explicit live templates with editable fields for def, async def, and Low fn. Normal completion acceptance inserts a function name only; accepting with ( assists a call. High/Low semantic highlighting, compiler-backed completion, diagnostics, and navigation are candidate features requiring the matching compiler. Navigation requires an exact compiler source location, and diagnostics report only the first error. The standard Parameter Info action displays a signature and argument position resolved in the current compiler snapshot. Cold analysis shares the existing debounced background worker; stale responses do not reopen hints. Candidate editing assistance, colors, and parameter hints passed 117 headless fixture tests and Plugin Verifier on IDEA 2026.3 EAP (263.6259.32). The new changes remain unverified on PyCharm, GUI/IME interaction, and IDEA 2025.1.

Generation retention is also under test with compiler 0.2.0 and applies only to IDE-managed runs. Published nagic 0.1.11 supports normal CLI Check/Run but does not automatically reclaim generations. CLI generations are retained, and the shared Cargo cache is separate. Candidate cleanup protects a latest generation only after a recorded successful native run, active generations, generations referenced by all apps' input snapshots, and the last-good generation after failure. Compile success alone is not run success; managed generations with unknown input metadata are retained. There is no strict generation-count or disk-capacity limit, and a referenced generation can survive until an additional successful sweep after its owner is removed. The temporary compiler 0.1.12 candidate was cancelled. JetBrains 0.1.3 remains an unreleased plugin candidate. See project configuration for the distinction between generations and the Cargo cache.

Use Nagi extension 0.1.13 and nagic 0.1.11 after its availability is confirmed in the official 0.1.11 release record. This guide targets the 0.1.11 release. Open the repository in VS Code, or save the example below in your own folder.

On this page

Indentation support

Extension 0.1.12 and later support indentation after headers such as def main():, else/case alignment, and closing delimiter alignment in multiline expressions.

Typing the final colon of else: or case ...: aligns it with its enclosing if or match. The default is four spaces; the editor's indentation settings are respected. This runs without the compiler, including in new untitled files. See indentation while typing for behavior and settings.

Open the example

Open examples/tutorial/editor_types.nagi, which contains this complete program:

class Count:
    value: i64

def parse_count(text: str) -> Result[Count, Error]:
    number = try parse_i64(text)
    return ok(Count(value=number))

def show(count: Count):
    print(count.value)

def main():
    result = parse_count("42")
    match result:
        case Ok(count):
            show(count)
        case Err(problem):
            print(error_message(problem))

Use the top-right run button or Nagi: 実行 (Run) in the Command Palette to print 42. Execution saves the file first. Extension command labels are currently Japanese.

Inspect variable types

Hover these names. The compiler's inferred types appear even without explicit annotations.

Name and location Displayed type Why
text in parse_count text: str Parameter annotation
number number: i64 try extracts parse_i64's success value
count in show count: Count Parameter annotation
result in main result: Result[Count, Error] parse_count's return type
count in the Ok case count: Count Result success payload
problem in the Err case problem: Error Result failure payload

Case names exist only in that case. Typing count after the match does not show the Ok binding's type. New variables inside if/while/for/scope blocks also stop being available outside the block. Unannotated integers normally infer i64 and floats f64. See types and inference.

Complete fields

In show's print(count.value), remove value to get print(count.). If candidates do not appear, press Ctrl+Space. Selecting value: i64 restores count.value. You can also complete after typing count.va.

Calls returning classes (make().), nested fields (container.item.), and Copy-class list elements (items[0].) offer fields for the expression's type. Selecting a field inserts only its name.

Result has type Result[Count, Error], so result. does not offer Count fields. Extract Count through match as above. In a Result-returning function, use count = try parse_count("42") or (try parse_count("42")).value. Fields on awaited values similarly use (await fetch()).field.

Call functions and find definitions

Type part of a name or press Ctrl+Space for project functions, classes, and built-ins. Function completion inserts argument placeholders; Tab moves between them. Class completion inserts named arguments such as Count(value=...). Typing ( or , shows parameter order and types.

Press F12 on parse_count or Count to reach its definition. On an import string, F12 opens the file. Previously saved files support unsaved edits and changes in open imports.

Try F12 on these local names:

Name under the cursor Destination
text in parse_i64(text) parse_count parameter text: str
number in Count(value=number) number = try parse_i64(text)
count in print(count.value) show parameter count: Count
result in match result result = parse_count("42")
count in show(count) case Ok(count)
problem in error_message(problem) case Err(problem)

Reassigned names navigate to their first binding. A for binding reusing an outer name targets the loop binding inside the loop and the original afterward. New if/while/scope/case bindings apply only in their blocks. Navigation can work after moves or initializer type errors if a binding is identifiable. F12 for class field names and built-ins is not supported.

Try module candidates and definitions

Open module_imports.nagi from the module example. Press Ctrl+Space after orders. to see Order and total, defined in orders.nagi itself. After current., the candidates are class fields such as amount. The compiler's name resolution and type information distinguish module definitions from class fields.

Hover and parameter hints on orders.total show its function declaration; hovering SavedOrder shows the original class's fields. Press F12 on total in orders.total or the from alias SavedOrder to reach the original definition in orders.nagi. Open and edit orders.nagi without saving to query the edited buffer. If a local shadows a module name, assistance follows that scope's resolution.

When editor information is unavailable

Previously saved Nagi/Low files are analyzed in memory with their unsaved edits, including open imports and native Low. Queries do not save or build sources. Save new files and nagi.toml to use project information.

Extension 0.1.12 and later also offer keyword/type completion and built-in completion, hover, and argument hints in new unsaved files, without a compiler, and in untrusted workspaces. When the source cannot be analyzed, unresolved imports or same-name bindings in the file suppress built-in information that could refer to another definition. Local types, field candidates, and F12 require the compiler and a trusted workspace.

State Information shown or action
Only the field after value. is incomplete Field candidates if the receiver's type is known
Unclosed parentheses elsewhere Saved function/class declarations marked “保存済み” (saved); no local types, fields, or F12
Undefined types/names, moved values, or names outside scope No guessed types; check Problems
Local types, field completion, or local F12 unavailable Update both compiler and extension
Helper functions missing Check imports from nagi.toml's entry
Project declarations, local types, or F12 unavailable Check workspace trust, nagi.compilerPath, and the Nagi Output channel

Edits clear stale Problems diagnostics. Automatic checks run on opening and saving files, not on every keystroke. Nagi: 型検査 (Type Check) also reads unsaved edits to previously saved files without saving or building. Save new files and nagi.toml first. Lower, build, and run save project files before executing. Seeing a type in a hover or completion does not mean the whole program passed checking.

Nagi 0.2.0 · DocsPage source