Skip to content

Provide completions based on symbols appearing in opened files #14

Open
@skr2005

Description

@skr2005

Is your feature request related to a problem? Please describe.

In Common Lisp, code frequently employs numerous user-defined macros, which often introduce symbols in non-standard or customized ways. I understand that this makes providing auto-completion suggestions challenging and that the current extension cannot handle many such cases. For example, when a user defines a macro that wraps the defun construct, as shown below:

(defmacro def (func-name lambda-list &body body)
  `(defun ,func-name ,lambda-list 
     ,@body))

(def simple-function (x) x)

(print (simple-function "HeLlO"))
(print (simple-function "WoLrd"))

At present, the extension does not offer any completion suggestions for the symbol simple-function. Similar issues occur when variables are defined through macros or when symbols are introduced via file loading mechanisms (e.g., using load). The flexible nature of symbol introduction in Common Lisp poses a challenge for the extension when using conventional code analysis methods.

Describe the solution you'd like.
VSCode provides a simple word-based completion feature that suggests words based on the text in the opened files. However the VSCode built-in word-based completion cannot be configured to work alongside extension-provided completions (see this Stack Overflow discussion).

I propose adding a dedicated word-based completion provider to the extension that scans for symbols in opened files written in Common Lisp and uses these as suggestions for auto-completion. Although this provider may not always produce contextually perfect suggestions, it is better to provide a basic level of completion than none at all.

Describe alternatives you've considered.
One alternative is to wait for VSCode to incorporate the feature discussed in this GitHub issue, which may eventually allow users to configure word-based completion directly in VSCode without modifying the extension. However, VSCode’s built-in word-based completion cannot handle Common Lisp tokenization correctly (for example, splitting simple-function into simple and function).

Another possibility is to improve the existing completion provider to better handle symbols introduced through constructs like load and defmacro. However, this solution would likely involve a significantly more complex implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions