Comments (21)
Sorry that I cannot help you more on this. I would first suspect the case of #12. It has to be something wrong with your configuration. sweat
This seems like a complicated issue to me, at least for now.
If you got any other questions, feel free to ask!
Thank you again.
from company-fuzzy.
Thanks! Just saw it in the news.
I might leave the document for a while and update it as soon as I have time to do so. 👍 Feel free to open a PR if you feel like to.
from company-fuzzy.
To be frank. I tried, but failed to run this package at all. The environment is Ubuntu 20.04 and Emacs/company-mode git master versions.
from company-fuzzy.
Can you post your config here? Thanks!
from company-fuzzy.
(use-package company
:hook ((after-init . global-company-mode)
(global-company-mode . company-tng-mode))
:init
;werner@X10DAi:~/.emacs.d/straight/repos/company-mode$ rg -uu -o -- '[^( ]+-ignore-case ' | grep ':' | awk -F: '{print $2}' | sort -u
;company-dabbrev-code-ignore-case
;company-dabbrev-ignore-case
;company-etags-ignore-case
;completion-ignore-case
(setq completion-ignore-case t
company-dabbrev-code-ignore-case t
company-dabbrev-ignore-case t
company-etags-ignore-case t
;The idle delay in seconds until completion starts automatically.
company-idle-delay 0.8
; The minimum prefix length for idle completion.
company-minimum-prefix-length 1
; The maximum number of candidates in the tooltip.
company-tooltip-limit 15
; If enabled, show quick-access numbers for the first ten candidates.
company-show-numbers t
;If enabled, disallow non-matching input.
;This can be a function do determine if a match is required.
;This can be overridden by the backend, if it returns t or ‘never’ to
;‘require-match’. ‘company-auto-commit’ also takes precedence over this.
company-require-match nil
;When non-nil, align annotations to the right tooltip border.
company-tooltip-align-annotations t
;Whether to downcase the returned candidates.
;The value of nil means keep them as-is.
;‘case-replace’ means use the value of ‘case-replace’.
;Any other value means downcase.
;If you set this value to nil, you may also want to set
;‘company-dabbrev-ignore-case’ to any value other than ‘keep-prefix’.
company-dabbrev-downcase nil
;; If enabled, selecting item before first or after last wraps around.
company-selection-wrap-around t
;; Non-nil to ignore case when collecting completion candidates.
company-dabbrev-ignore-case t
company-global-modes
'(not erc-mode
message-mode
help-mode
gud-mode
vterm-mode)
company-frontends
'(company-pseudo-tooltip-frontend ; always show candidates in overlay tooltip
company-echo-metadata-frontend) ; show selected candidate docs in echo area
;; Buffer-local backends will be computed when loading a major mode, so
;; only specify a global default here.
company-backends '(company-capf)
;; These auto-complete the current selection when
;; `company-auto-complete-chars' is typed. This is too magical. We
;; already have the much more explicit RET and TAB.
company-auto-complete nil
company-auto-complete-chars nil
;; Only search the current buffer for `company-dabbrev' (a backend that
;; suggests text your open buffers). This prevents Company from causing
;; lag once you have a lot of buffers open.
company-dabbrev-other-buffers nil)
:config
;; Enable downcase only when completing the completion.
(defun jcs--company-complete-selection--advice-around (fn)
"Advice execute around `company-complete-selection' command."
(let ((company-dabbrev-downcase t))
(call-interactively fn)))
(advice-add 'company-complete-selection :around #'jcs--company-complete-selection--advice-around)
)
; https://github.com/hlissner/doom-emacs/blob/develop/modules/completion/company/config.el#L96
(use-package company-box
:after company-mode
:hook (company-mode . company-box-mode))
;https://github.com/vspinu/company-math/issues/19#issuecomment-868331208
(use-package company-math)
(add-to-list 'company-backends 'company-math-symbols-unicode)
(defun my-latex-mode-setup ()
(setq-local company-backends
(append '((
company-math-symbols-latex
company-latex-commands
))
company-backends)))
(add-hook 'TeX-mode-hook 'my-latex-mode-setup)
;https://github.com/company-mode/company-mode/issues/1128#issuecomment-873313694
;https://github.com/company-mode/company-mode/issues/1128#issuecomment-872710453
;https://github.com/TommyX12/company-tabnine
;Run M-x company-tabnine-install-binary to install the TabNine binary for your system.
(use-package company-tabnine)
;https://manateelazycat.github.io/emacs/2021/06/30/company-multiple-backends.html
;; Customize company backends.
(setq company-backends
'(
;https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/Spell-check.html
;sudo apt-get install aspell
;`M-x describe-variable ispell-program-name RET`
;Its value is "/usr/bin/aspell"
(company-tabnine :separate company-dabbrev company-keywords company-files company-ispell company-capf)
))
;; Add yasnippet support for all company backends.
(defvar company-mode/enable-yas t
"Enable yasnippet for all backends.")
(defun company-mode/backend-with-yas (backend)
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
backend
(append (if (consp backend) backend (list backend))
'(:with company-yasnippet))))
(setq company-backends (mapcar #'company-mode/backend-with-yas company-backends))
;; Remove duplicate candidate.
(add-to-list 'company-transformers #'delete-dups)
(use-package flx)
(use-package company-fuzzy)
(global-company-fuzzy-mode 1)
(setq company-fuzzy-sorting-backend 'flx)
The error:
Company: An error occurred in post-command
Company: frontend company-pseudo-tooltip-frontend error "Company: backend company-fuzzy-all-other-backends error "Wrong type argument: numberp, nil" with args (pre-render foodstuffs nil)" on command post-command
Starting "look" process...
Company: An error occurred in post-command
Company: frontend company-pseudo-tooltip-frontend error "Company: backend company-fuzzy-all-other-backends error "Wrong type argument: numberp, nil" with args (pre-render you nil)" on command post-command
from company-fuzzy.
Wow, there are many things going on here.
I have added a FAQ section at the bottom of the README file. These information should be sufficient to teach you use and debug this plugin.
The error just mean company-fuzzy
has correctly handled other backends yet it does not mean that it's from this package itself. This can be cause by a particular backend you are using, see #12 for more information.
I would suggest you eliminate some of the backends and find out the backend that doesn't work with company-fuzzy
. Like company-tabnine
, company-math-symbols-latex
, company-latex-commands
, etc.
from company-fuzzy.
I commented out all the above-mentioned sections, but still meet the same error. See the output of M-x company-diag RET
:
Emacs 28.0.50 (x86_64-pc-linux-gnu) of 2021-07-08 on X10DAi
Company 0.9.13
company-backends: (company-fuzzy-all-other-backends)
Used backend: company-fuzzy-all-other-backends
Major mode: latex-mode
Prefix: #("arr" 0 3
(wrap-prefix " " fontified t))
Completions: none
from company-fuzzy.
Are you using this with command company-diag
? Then this issue is related to #15.
Sorry that I don't often use company-diag and not sure how to integrate it company-fuzzy with that command. 😕
Edit: Company-diag will always return no completions but company-fuzzy
should still work on it's own. company-diag
would not give you the correct information since this package interferes the behaviour to company-mode entirely so that's how it is.
from company-fuzzy.
Are you using this with command
company-diag
? Then this issue is related to #15.
Yes. As I've told above.
Sorry that I don't often use company-diag and not sure how to integrate it company-fuzzy with that command. confused
Edit: Company-diag will always return no completions but
company-fuzzy
should still work on it's own.company-diag
would not give you the correct information since this package interferes the behaviour to company-mode entirely so that's how it is.
But it doesn't give me the fuzzy completion effect at all.
from company-fuzzy.
I have tried with emacs -q
and the following config
(require 'package)
(setq package-archives
'(("celpa" . "https://celpa.conao3.com/packages/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(package-initialize)
(setq company-backends
(append
;; --- Internal ---
'(company-capf company-semantic)
'(company-keywords)
'(company-abbrev company-dabbrev company-dabbrev-code)
'(company-files)
'(company-etags company-gtags)
'(company-yasnippet)))
(global-company-mode 1)
(global-company-fuzzy-mode 1)
it works fine in clean environment. 😕
from company-fuzzy.
I confirmed your result with the following configuration, using straight as the package manager:
;$ emacs -q --load ~/.emacs.d/init.company-fuzzy
;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package company)
(use-package company-fuzzy)
(setq company-backends
(append
;; --- Internal ---
'(company-capf company-semantic)
'(company-keywords)
'(company-abbrev company-dabbrev company-dabbrev-code)
'(company-files)
'(company-etags company-gtags)
'(company-yasnippet)))
(global-company-mode 1)
(global-company-fuzzy-mode 1)
Test it and see the screenshot below:
$ emacs -q --load ~/.emacs.d/init.company-fuzzy
But see the following result:
Why the candidate doesn't include "arrow" at all?
BTW, how do I further integrate my original settings?
from company-fuzzy.
Why the candidate doesn't include "arrow" at all?
Why would you expect an "arrow"? Does it located inside any backend? 😕 Try setup with flx, (setq company-fuzzy-sorting-backend 'flx)
.
I also added one faq here, hope this help you understand the problem.
BTW, how do I further integrate my original settings?
If it works in clean Emacs, I suspect the issue is from you configuration. As I mention in the previous post, try eliminate your configuration and see what causes the issue that hampering you from integration.
You can look at my configuration here, yet I don't know if this would help. 😅
from company-fuzzy.
Why would you expect an "arrow"? Does it located inside any backend?
I want to show that if the search keyword doesn't match all possible entries, there shouldn't have any candidate been shown up.
confused Try setup with flx,
(setq company-fuzzy-sorting-backend 'flx)
.
I tried with the following settings, but still get the same result:
;;; $ emacs -q --load ~/.emacs.d/init.company-fuzzy
;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package company)
(use-package company-fuzzy)
(setq company-backends
(append
;; --- Internal ---
'(company-capf company-semantic)
'(company-keywords)
'(company-abbrev company-dabbrev company-dabbrev-code)
'(company-files)
'(company-etags company-gtags)
'(company-yasnippet)))
(global-company-mode 1)
(global-company-fuzzy-mode 1)
(use-package flx)
(setq company-fuzzy-sorting-backend 'flx)
I only want to have the substring based match characteristics, i.e., the input string as a whole appeared in any part of the matched results.
from company-fuzzy.
I want to show that if the search keyword doesn't match all possible entries, there shouldn't have any candidate been shown up.
I see what you mean here.
It does contains arrow! See [a]ttempt-o[r]de[r]ly-shutd[o][w]n-on-fatal-signal
. This is how fuzzy completion works, it shows all possible candidates at point with a valid score (not 0).
I only want to have the substring based match characteristics, i.e., the input string as a whole appeared in any part of the matched results.
Sorry but this isn't support to any fuzzy algorithm. Feel free to post any possible algorithm here that matches your needs, so I can try implement to it.
from company-fuzzy.
It does contains arrow! See
[a]ttempt-o[r]de[r]ly-shutd[o][w]n-on-fatal-signal
. This is how fuzzy completion works, it shows all possible candidates at point with a valid score (not 0).
To be frank, fuzzy matching like this has the following disadvantages:
- If the candidates list is very long, the efficiency reduction is very fast and the response time will be greatly delayed.
- In most cases, the filtered out result as described by the fuzzy completion above is not what we want, instead, the more meaningful result set should be the candidates by substring based match.
Sorry but this isn't support to any fuzzy algorithm. Feel free to post any possible algorithm here that matches your needs, so I can try implement to it.
I think, but am not sure, that there should have substring based match functions/macros existing in the current Emacs implementation, just as many of the company's backends do.
from company-fuzzy.
I think, but am not sure, that there should have substring based match functions/macros existing in the current Emacs implementation, just as many of the company's backends do.
If you only want the substring base then I guess that does not call "fuzzy"? I guess you should not use package in the first place? 😖
Like, bfn
should return buffer-file-name
so I don't have to type all the way up.
from company-fuzzy.
If you only want the substring base then I guess that does not call "fuzzy"? I guess you should not use package in the first place?
Based on your configuration, I tried out the following:
;;; $ emacs -q --load ~/.emacs.d/init.company-fuzzy
;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;https://github.com/jcs-elpa/company-fuzzy/issues/16#issuecomment-877958899
(use-package company
:init
(setq company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
company-require-match nil
company-tooltip-align-annotations t
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-eclim-auto-save nil
company-minimum-prefix-length 0
company-idle-delay 0.1
company-selection-wrap-around 'on
company-format-margin-function #'company-detect-icons-margin)
(setq company-backends
(append
;; --- Internal ---
'(company-capf company-semantic)
'(company-keywords)
'(company-abbrev company-dabbrev company-dabbrev-code)
'(company-files)
'(company-etags company-gtags)
'(company-yasnippet)
;; --- External ---
'(company-emoji))))
(global-company-mode 1)
(use-package flx)
(use-package company-fuzzy
:init
(setq company-fuzzy-sorting-backend 'flx
company-fuzzy-prefix-on-top nil
company-fuzzy-history-backends '(company-yasnippet)
company-fuzzy-trigger-symbols '("." "->" "<" "\"" "'"))
(with-eval-after-load 'company (global-company-fuzzy-mode t)))
Based on my tries, all the above configurations give the same match results. It seems that the most important thing is the location of the following command in the configuration:
(global-company-mode 1)
It must be put immediately before the call of company-fuzzy
relevant packages, otherwise, the fuzzy match will fail to work. But I still failed to figure out the workable configuration in my case.
Like,
bfn
should returnbuffer-file-name
so I don't have to type all the way up.
Got it. Thank you for clarifying the possible use scenarios for fuzzy matching.
In fact, the results given by company-fuzzy
also include the substring matching results, as shown below:
from company-fuzzy.
Based on my tries, all the above configurations give the same match results. It seems that the most important thing is the location of the following command in the configuration:
(global-company-mode 1)
It must be put immediately before the call of company-fuzzy relevant packages, otherwise, the fuzzy match will fail to work.
In theory, if you have done configure company-backends
then it should be good. And of course, company-fuzzy-mode
would just assume you have company-mode
enabled before hand. Two minor modes work separately, so one should not effect to another.
But I still failed to figure out the workable configuration in my case.
Sorry that I cannot help you more on this. I would first suspect the case of #12. It has to be something wrong with your configuration. 😓
If you got any other questions, feel free to ask!
from company-fuzzy.
I tried the following configuration, and it worked, but the latency was very high, which was not realistic for a practical scenario:
;;; $ emacs -q --load ~/.emacs.d/init.company-fuzzy
;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;https://github.com/jcs-elpa/company-fuzzy/issues/16#issuecomment-877958899
(use-package company
:init
(setq company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
company-require-match nil
company-tooltip-align-annotations t
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-eclim-auto-save nil
company-minimum-prefix-length 0
company-idle-delay 0.1
company-selection-wrap-around 'on
company-format-margin-function #'company-detect-icons-margin)
(setq company-backends
(append
;; --- Internal ---
'(company-capf company-semantic)
'(company-keywords)
'(company-abbrev company-dabbrev company-dabbrev-code)
'(company-files)
'(company-etags company-gtags)
'(company-yasnippet)
;; --- External ---
'(company-emoji))))
; https://github.com/hlissner/doom-emacs/blob/develop/modules/completion/company/config.el#L96
(use-package company-box
:after company-mode
:hook (company-mode . company-box-mode))
;https://github.com/vspinu/company-math/issues/19#issuecomment-868331208
(use-package company-math)
(add-to-list 'company-backends 'company-math-symbols-unicode)
(defun my-latex-mode-setup ()
(setq-local company-backends
(append '((
company-math-symbols-latex
company-latex-commands
))
company-backends)))
(add-hook 'TeX-mode-hook 'my-latex-mode-setup)
(use-package company-tabnine)
(setq company-backends
'(
;https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/Spell-check.html
;sudo apt-get install aspell
;`M-x describe-variable ispell-program-name RET`
;Its value is "/usr/bin/aspell"
(company-tabnine :separate company-dabbrev company-keywords company-files company-ispell company-capf)
))
;; Add yasnippet support for all company backends.
(defvar company-mode/enable-yas t
"Enable yasnippet for all backends.")
(defun company-mode/backend-with-yas (backend)
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
backend
(append (if (consp backend) backend (list backend))
'(:with company-yasnippet))))
(setq company-backends (mapcar #'company-mode/backend-with-yas company-backends))
;; Remove duplicate candidate.
(add-to-list 'company-transformers #'delete-dups)
(global-company-mode 1)
(use-package flx)
(use-package company-fuzzy
:init
(setq company-fuzzy-sorting-backend 'flx
company-fuzzy-prefix-on-top nil
company-fuzzy-history-backends '(company-yasnippet)
company-fuzzy-trigger-symbols '("." "->" "<" "\"" "'"))
(with-eval-after-load 'company (global-company-fuzzy-mode t)))
from company-fuzzy.
Try raise the gc-cons-threshold
.
See https://github.com/lewang/flx#memory-usage for more information.
from company-fuzzy.
I tried with a very large gc-cons-threshold
, but it doesn't solve the problem:
(setq gc-cons-threshold 20000000000)
It should be noted that the very high delay only appears before the input sequence long is equal to or less than 3. If beyond this threshold, there is no such problem.
from company-fuzzy.
Related Issues (20)
- Company: frontend company-pseudo-tooltip-unless-just-one-frontend error "Invalid regexp: "Trailing backslash"" on command post-command HOT 4
- Company-complete doesn't complete when inside of string HOT 2
- Report special case for company backend HOT 11
- company-keywords backend is not working after recent update HOT 5
- company-diag is obscured when using company-fuzzy HOT 10
- Error running with doom emacs HOT 9
- Order is not respected when variable starts with @ (ruby-mode) HOT 3
- wrong-type-argument stringp after recent changes HOT 1
- Link to configuration in the readme doesn't work HOT 1
- Appropriate hook to enable after changing backends HOT 4
- Yasnippet offers candidates for every prefix HOT 4
- Using company-fuzzy with merged backends HOT 3
- The incorrect result returned by company-fuzzy. HOT 15
- Ignores candidates that do not match prefix HOT 8
- Adding yasnippet as a backend, doesn't complete when calling company-complete-selection HOT 2
- With Rustic, Icons and Type information disappear after changing selected completion. HOT 1
- Unknown `company` source, HOT 1
- Identify exact candidate with different source.
- Args out of range in doom-emacs until company-fuzzy-mode mode reloaded HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from company-fuzzy.