Research-Stack/2-Search-Space/search/stract/crates/optics-lsp
2026-05-08 15:04:30 -05:00
..
.cargo initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
src initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
.gitignore initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
.vscodeignore initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
Cargo.lock Fix Dependabot dependency alerts 2026-05-08 15:04:30 -05:00
Cargo.toml initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
extension.ts initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
justfile initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
LICENSE.md initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
README.md initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
server.ts initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00

Optics VS Code Extension

This extension makes it easier to edit .optic files. An optic is used by Stract and gives you complete control over which search results gets returned and how they are ranked. This extension includes syntax highlighting for the optics language and an LSP to detect syntax errors.

Sample .optic syntax

This small sample hopefully gives you a quick introduction to the optics language.

// Most optics contains a sequence of rules that applies an action to matching search results
// This rule matches all urls that contain the term "/forum" and boosts their score by 3
Rule {
    Matches {
        Url("/forum")
    },
    Action(Boost(3))
};

// you can also downrank results
Rule {
    Matches {
        Site("w3schools.com")
    },
    Action(Downrank(3))
};

// or completely discard the result from your search results
Rule {
    Matches {
        Site("gitmemory.com")
    },
    Action(Discard)
};

See our quickstart for a more thorough and up-to-date walk through.