Summary
Create a new nemo-lsp binary crate that implements the Language Server Protocol over stdio using tower-lsp. The server reuses nemo-config for parsing and nemo-registry for schema access, providing autocomplete, hover documentation, diagnostics, and go-to-definition for Nemo XML files.
Context
Authors currently write Nemo XML with no editor assistance beyond basic XML syntax. The existing schema/nemo.xsd provides XML structure validation but cannot encode component-specific property constraints. The LSP bridges this gap by using the live ComponentRegistry and ConfigSchema data.
The LSP reuses existing infrastructure — no new parsing logic needed:
nemo-config::XmlParser — parse XML into Value trees
nemo-config::ConfigValidator — schema-based validation with error locations
nemo-config::ConfigSchema / PropertySchema — property types, defaults, constraints
nemo-registry::ComponentRegistry — component list, search, category grouping
nemo-config::ConfigResolver — expression evaluation for ${} syntax
Acceptance Criteria
Relevant Files
schema/nemo.xsd — existing XML schema with attribute groups
crates/nemo-config/src/xml_parser.rs — XML parser
crates/nemo-config/src/validator.rs — ConfigValidator, ValidationResult
crates/nemo-config/src/resolver.rs — ConfigResolver, expression evaluation
crates/nemo-config/src/schema.rs — ConfigSchema, PropertySchema
crates/nemo-registry/src/registry.rs — ComponentRegistry
crates/nemo-registry/src/builtins.rs — component registration
crates/nemo-registry/src/descriptor.rs — ComponentDescriptor
crates/nemo-config/src/error.rs — ValidationError
Cargo.toml — workspace members
Stack Base
Summary
Create a new
nemo-lspbinary crate that implements the Language Server Protocol over stdio usingtower-lsp. The server reusesnemo-configfor parsing andnemo-registryfor schema access, providing autocomplete, hover documentation, diagnostics, and go-to-definition for Nemo XML files.Context
Authors currently write Nemo XML with no editor assistance beyond basic XML syntax. The existing
schema/nemo.xsdprovides XML structure validation but cannot encode component-specific property constraints. The LSP bridges this gap by using the liveComponentRegistryandConfigSchemadata.The LSP reuses existing infrastructure — no new parsing logic needed:
nemo-config::XmlParser— parse XML intoValuetreesnemo-config::ConfigValidator— schema-based validation with error locationsnemo-config::ConfigSchema/PropertySchema— property types, defaults, constraintsnemo-registry::ComponentRegistry— component list, search, category groupingnemo-config::ConfigResolver— expression evaluation for${}syntaxAcceptance Criteria
New crate at
crates/nemo-lsp/withtower-lspdependencyLSP capabilities implemented:
Completion — component element names
<layout>or as a child elementComponentRegistry.list_components()→ XML tag namesCompletion — attribute names
ComponentDescriptor.schema.propertieskeysschema/nemo.xsdattribute groups (layout-attrs, border-attrs, decoration-attrs, event-attrs, binding-attrs)Completion — enum values
OneOfvalidation rulePropertySchema.rules→ValidationRule::OneOf(values)Hover documentation
PropertySchema.descriptionformatted as MarkdownDiagnostics
ConfigValidatoron the documentValidationErrorto LSPDiagnosticwith range informationnemo-config::SourceLocation(line/column)Completion — data binding paths
<binding source="...">andbind-*attributes<data>source definitions in current fileCompletion — template references
template="..."attribute values<templates>block in current fileCompletion — handler names
on-click="...",on-change="...", etc..rhaifile function names from configured script directoryGo-to-definition
template="name"→ jump to<template name="name">source="datasource"→ jump to<source name="datasource">LSP activated for files containing a
<nemo>root element (viaworkspace/didChangeWatchedFilesor content-based detection)Server starts with reasonable defaults (no config file required for basic operation)
Logging to file (not stdout, which is the LSP transport) via
tracingCargo workspace member added to root
Cargo.tomlRelevant Files
schema/nemo.xsd— existing XML schema with attribute groupscrates/nemo-config/src/xml_parser.rs— XML parsercrates/nemo-config/src/validator.rs—ConfigValidator,ValidationResultcrates/nemo-config/src/resolver.rs—ConfigResolver, expression evaluationcrates/nemo-config/src/schema.rs—ConfigSchema,PropertySchemacrates/nemo-registry/src/registry.rs—ComponentRegistrycrates/nemo-registry/src/builtins.rs— component registrationcrates/nemo-registry/src/descriptor.rs—ComponentDescriptorcrates/nemo-config/src/error.rs—ValidationErrorCargo.toml— workspace membersStack Base
main