Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove company dependency #1

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Remove company dependency #1

merged 1 commit into from
Sep 13, 2023

Conversation

gmlarumbe
Copy link
Owner

company was previously required to handle the limitation of gathering completions from multiple backends/functions with completion-at-point:

  • The default for comint is to set completion-at-point-functions to comint-dynamic-complete-functions
  • In turn, comint-dynamic-complete-functions has the default value '(comint-c-a-p-replace-by-expanded-history comint-filename-completion). These functions work as if they were completion-at-point-functions themselves, returning completions if found and returning nil and checking next function if not. The recommended approach is to add a new capf function to comint-dynamic-complete-functions.
  • If completion for both, files and commands, is set with two different functions, results found by one could mask the results found by the other. For example:
    • Consider current shell $PWD is /home/user
    • Type "r"
    • Try completions:
      • First function is called: comint-filename-completion
        • Finds a directory named "repos" and returns it as a completion candidate
      • Second function fpga-*-capf is not called since previous one was already successful
        • Commands like "run" or "remove" will be missed
      • In this case commands are masked by files. Placing commands function before the files one in the hook would also have a masking effect.

The PR implements a single capf function that handles both files and commands.

It also adds a customizable variable: fpga-utils-shell-file-completion, if file completion inside capf is not desired. This could be the case if using company-files backend with the following snippet:

(setq-local comint-dynamic-complete-functions '(fpga-xilinx-vivado-shell-capf))
(setq-local company-backends '(company-files company-capf))

@gmlarumbe gmlarumbe merged commit b62997d into main Sep 13, 2023
4 checks passed
@gmlarumbe gmlarumbe deleted the remove-company-dependency branch September 13, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant