feat: complete BLOCK_LIST/ADDR_LIST keywords and space comments
Add keyword-driven completions for BLOCK_LIST and ADDR_LIST in the LSP server. - While typing a prefix of these keywords the server returns the keyword(s) as incomplete snippet suggestions that trigger a re-request. - Once the keyword is typed the server replaces it with a full list of the corresponding loaded block templates or addresses (quoted), and sets each item's filter_text to include the keyword so further typing narrows results. - Integrate this flow into on_completion and factor the symbol-list logic into a helper that returns either incomplete keyword suggestions or the completed symbol list. Also implement NxFormatter.format_comment to ensure a single space after a leading '#' for comments that don't already start with whitespace, while leaving sequences of '#' (separators), shebangs, and already-spaced comments unchanged. This affects both standalone and inline comments. Add/rename tests to cover the new completions and comment-spacing behavior.
This commit is contained in:
@@ -12,6 +12,14 @@ class NxFormatter(BaseFormatter):
|
||||
while leaving all other formatting behavior unchanged.
|
||||
"""
|
||||
|
||||
def format_comment(self, comment) -> List[str]: # type: ignore[override]
|
||||
# "#Comment" -> "# Comment". Leave "#", "##..." separators, "#!" and
|
||||
# comments that already start with whitespace untouched.
|
||||
value = comment.value
|
||||
if value and not value[0].isspace() and value[0] not in "#!":
|
||||
value = " " + value
|
||||
return [f"#{value}"]
|
||||
|
||||
def format_braced_expression(self, expr) -> List[str]: # type: ignore[override]
|
||||
# This method mirrors BaseFormatter.format_braced_expression but inserts
|
||||
# a line continuation (" \") between continuation lines similar to
|
||||
|
||||
Reference in New Issue
Block a user