Native-First IDE Services for F#
Language Server Protocol backend for the Fidelity framework ecosystem.
FsNativeAutoComplete (FSNAC) is a fork of FsAutoComplete designed to provide rich IDE services for native F# compilation. Where the original FSAC assumes .NET projects with .fsproj and NuGet packages, FSNAC understands .fidproj manifests, source-based dependencies, and the native type semantics that power the Fidelity framework.
FSNAC is the IDE companion to FSharpNative Compiler Services (FNCS). Together they provide a complete development experience for native F# compilation: FNCS handles type checking and semantic analysis, while FSNAC delivers that information to your editor.
FSNAC is part of the Fidelity native F# compilation ecosystem:
| Project | Role |
|---|---|
| Firefly | AOT compiler: F# -> PSG -> MLIR -> Native binary |
| FNCS | F# Native Compiler Services (type checking) |
| FSNAC | F# Native AutoComplete (this repository) |
| Alloy | Native standard library with platform bindings |
| XParsec | Parser combinators for TOML and PSG traversal |
| BAREWire | Binary encoding and zero-copy IPC |
| Farscape | C/C++ header parsing for native bindings |
The name "Fidelity" reflects the framework's mission: preserving type and memory safety from source through compilation to native execution.
The standard FsAutoComplete does an excellent job for .NET development. But when you're targeting native compilation without a runtime, several assumptions become obstacles:
Projects are MSBuild XML files. Native compilation uses .fidproj TOML manifests that specify memory models, platform targets, and source-based dependencies.
Dependencies are NuGet packages. Fidelity uses source-based distribution through the fpm package manager, enabling whole-program optimization across package boundaries.
Types resolve to BCL. FNCS provides native semantics for standard F# types: string has UTF-8 fat pointer semantics instead of System.String, option has value semantics instead of heap-allocated reference types.
FSNAC bridges these gaps, providing familiar IDE services while understanding native semantics.
FSNAC is established as a distinct, usable tool:
- Namespace transformation: Renamed from
FsAutoCompletetoFsNativeAutoComplete - TOML parsing: XParsec-based parser for
.fidprojfiles - FidprojLoader: Produces
FSharpProjectOptionsfrom TOML manifests - Dual-mode workspace: Supports
.fidprojand.fsprojin the same workspace
# Example .fidproj that FSNAC understands
[package]
name = "my_project"
version = "0.1.0"
[dependencies]
alloy = { path = "../alloy/src" }
[build]
sources = ["Program.fs"]
output = "my_project"
output_kind = "console"FSNAC now integrates with FNCS for native type resolution:
- Native type awareness: Display native type semantics (string as UTF-8 fat pointer, option as value type) in hover info
- Dual-mode routing: Automatically routes LSP requests to FNCS or FCS based on project type
- Semantic graph navigation: Uses FNCS SemanticGraph for hover, completions, and go-to-definition
- Platform binding detection: Recognizes
Platform.Bindingsmodule functions
The Fidelity framework leverages F#'s metaprogramming features as first-class compilation infrastructure. FSNAC will provide specialized support for these patterns:
Quotations (Expr<'T>) carry memory constraints and peripheral descriptors through the compilation pipeline. FSNAC will provide:
- Quotation structure visualization
- Navigation from quotation to generated code
- Semantic highlighting for compile-time evaluated expressions
// FSNAC understands this carries peripheral layout information
let gpioQuotation: Expr<PeripheralDescriptor> = <@
{ Name = "GPIO"
Instances = Map.ofList [("GPIOA", 0x48000000un)]
MemoryRegion = Peripheral }
@>Active patterns enable compositional matching throughout the nanopass pipeline. FSNAC will support:
- Pattern composition visualization
- Navigation to pattern definitions from match sites
- Type flow through partial active patterns
Computation expressions provide continuation notation that compiles to DCont and Inet dialects. FSNAC will recognize:
- Builder method resolution
- Continuation structure in complex workflows
- Dialect selection hints (sequential vs. parallel)
For advanced Fidelity development, FSNAC will support coordinated views:
| Pane | Format | Language Server |
|---|---|---|
| F# Source | .fs |
FSNAC |
| MLIR | .mlir |
mlir-lsp-server |
| LLVM IR | .ll |
clangd |
This enables tracing code from source through compilation stages.
FSNAC is a fork of the excellent FsAutoComplete project. We're grateful to the FSAC maintainers and the Ionide community for creating and maintaining the foundation we build upon.
Our modifications focus on project formats and type resolution, not core LSP functionality. The standard LSP endpoints remain compatible, ensuring FSNAC works with existing editor integrations.
FSNAC provides F# support for any LSP-capable editor:
- Visual Studio Code (via Ionide configuration)
- Neovim (via nvim-lspconfig)
- Helix
- Emacs (via eglot or lsp-mode)
- Kate
- Zed
lspconfig.fsautocomplete.setup {
cmd = { 'dotnet', 'fsnac' }, -- or path to FSNAC binary
filetypes = { 'fsharp' },
root_dir = lspconfig.util.root_pattern('*.fidproj', '*.fsproj', '*.sln'),
}
-- Associate .fidproj with TOML syntax
vim.filetype.add({ extension = { fidproj = 'toml' } })Requirements:
- .NET SDK (see
global.jsonfor version)
# Restore tools
dotnet tool restore
# Build
dotnet build
# Test
dotnet testFSNAC supports the standard LSP endpoints:
textDocument/completionwithcompletionItem/resolvetextDocument/hovertextDocument/definition,typeDefinition,implementationtextDocument/referencestextDocument/codeAction,codeLenstextDocument/formatting(via Fantomas)textDocument/renametextDocument/signatureHelptextDocument/documentSymboltextDocument/semanticTokensworkspace/symbol
fidelity/projectInfo- Query.fidprojconfigurationfidelity/memoryLayout- Get type memory layout informationfidelity/srtpResolution- Show SRTP witness resolutionfidelity/platformBindings- List platform binding mappings
| Phase | Description | Status |
|---|---|---|
| Phase 1 | Namespace rename and TOML parsing | ✅ Complete |
| Phase 2 | FNCS integration | ✅ Complete |
| Phase 3 | Metaprogramming support | Future |
| Phase 4 | Multi-pane development | Future |
FSNAC can serve as the LSP server for both .fsproj and .fidproj projects simultaneously:
For .fidproj (native) projects:
- ✅ TOML project file parsing
- ✅ Workspace loading via
fsharp/workspaceLoad - ✅ Hover information with native type semantics
- ✅ Completions from semantic graph
- ✅ Go-to-definition for local bindings
- ✅ Diagnostics publishing on file open/change
For .fsproj (standard) projects:
- ✅ Full FsAutoComplete functionality preserved
- ✅ MSBuild project loading
- ✅ NuGet package resolution
- ✅ All standard LSP features
The server automatically routes requests to the appropriate backend based on file membership in loaded projects.
┌─────────────────────────────────────────────────────────┐
│ Editor │
│ (VS Code, nvim, Helix, etc.) │
└─────────────────────────┬───────────────────────────────┘
│ LSP
┌─────────────────────────▼───────────────────────────────┐
│ FSNAC │
│ FsNativeAutoComplete LSP Server │
├─────────────────────────────────────────────────────────┤
│ FidprojLoader │ Standard LSP │ Custom │
│ (TOML → Options) │ Handlers │ Fidelity API │
└─────────────────────────┬───────────────────────────────┘
│
┌─────────────────────────▼───────────────────────────────┐
│ FNCS │
│ FSharpNative Compiler Services │
│ (Type checking, SRTP resolution, Native types) │
└─────────────────────────────────────────────────────────┘
Contributions are welcome. Areas of particular interest:
- SRTP resolution display - Showing resolved witness implementations in hover info
- Memory layout visualization - Displaying type memory layouts
- Testing with Fidelity projects - Validating against real native F# code
- Editor configuration guides - Documentation for various editors
- Custom endpoint implementation - Building out
fidelity/*LSP extensions
This project is licensed under the MIT License - see the LICENSE.md file for details.
Original FsAutoComplete work is copyright its respective authors. Modifications are copyright SpeakEZ Technologies.
- FsAutoComplete Team: For the excellent LSP foundation
- Ionide Project: For F# tooling infrastructure
- Don Syme and F# Contributors: For creating quotations, active patterns, and computation expressions—the "standing art" that powers native F# compilation
The IDE experience you know. Native semantics under the hood.