Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:
vim --version.:YcmDebugInfo.:YcmToggleLogs command.install.py (or cmake/make/ninja) including its invocationThank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
As a React developer I noticed that when using the import <file> syntax in a .jsx file, it will not autocomplete paths for me. After debugging I eventually find the bug and it has to do with the filetype in vim for React. Many, many people use set ft=javascript.jsx for *.jsx files and so do I. When setting something different from set ft=javascript, such as set ft=jsx or set ft=javascript.jsx YCM will not know it has to include path autocompletion, so I'd suggest also built support for jsx and javascript.jsx filetypes.
What did you do?
*.jsx file. :set ft=javascript.import '../[cursor]';As you see this should give the expected path completion. Now run the following: :set ft=javascript.jsx and when you type the import syntax again, when adding the / it will not autocomplete.
I expected that path completion in a javascript.jsx or jsx filetype would work when using the import <file> syntax.
It did not do the path autocompletion when inserting a / in a string.
vim --versionVIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 22 2018 05:24:30)
macOS version
Included patches: 1-202
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
++builtin_terms -gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages -toolbar
+cindent +insert_expand +path_extra +user_commands
-clientserver +job +perl +vartabs
+clipboard +jumplist +persistent_undo +vertsplit
+cmdline_compl +keymap +postscript +virtualedit
+cmdline_hist +lambda +printer +visual
+cmdline_info +langmap +profile +visualextra
+comments +libcall -python +viminfo
+conceal +linebreak +python3 +vreplace
+cryptv +lispindent +quickfix +wildignore
+cscope +listcmds +reltime +wildmenu
+cursorbind +localmap +rightleft +windows
+cursorshape -lua +ruby +writebackup
+dialog_con +menu +scrollbind -X11
+diff +mksession +signs -xfontset
+digraphs +modify_fname +smartindent -xim
-dnd +mouse +startuptime -xpm
-ebcdic -mouseshape +statusline -xsmp
+emacs_tags +mouse_dec -sun_workshop -xterm_clipboard
+eval -mouse_gpm +syntax -xterm_save
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.28.0/lib/perl5/5.28.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -lruby.2.5.1 -lobjc
YcmDebugInfo-- Client logfile: /var/folders/bd/m_gprcl50xb3tt874xyw4nzm0000gn/T/ycm_jt_18u7i.log
-- Server Python interpreter: /usr/local/opt/python/bin/python3.7
-- Server Python version: 3.7.0
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- JavaScript completer debug information:
-- Tern running at: http://127.0.0.1:51805
-- Tern process ID: 42841
-- Tern executable: /Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/tern/bin/ter
n
-- Tern logfiles:
-- /var/folders/bd/m_gprcl50xb3tt874xyw4nzm0000gn/T/tern_51805_stdout_u7r430t6.log
-- /var/folders/bd/m_gprcl50xb3tt874xyw4nzm0000gn/T/tern_51805_stderr_i6ww202w.log
-- Tern configuration file: /tech/.tern-project
-- Tern working directory: /tech
-- Server running at: http://127.0.0.1:51801
-- Server process ID: 42836
-- Server logfiles:
-- /var/folders/bd/m_gprcl50xb3tt874xyw4nzm0000gn/T/ycmd_51801_stdout_1oorzain.log
-- /var/folders/bd/m_gprcl50xb3tt874xyw4nzm0000gn/T/ycmd_51801_stderr_ottrj3w0.log
Failed to find library react.
2018-08-04 09:46:15,685 - ERROR - Unable to connect to server
Traceback (most recent call last):
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 91, in create_connection
raise err
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 81, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 353, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 162, in connect
conn = self._new_conn()
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 146, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x10adc8e10>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/adapters.py", line 376, in send
timeout=timeout
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/util/retry.py", line 273, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=51884): Max retries exceeded with url: /ready (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10adc8e10>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 79, in HandleFuture
return _JsonFromFuture( future )
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 239, in _JsonFromFuture
response = future.result()
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/pythonfutures/concurrent/futures/_base.py", line 404, in result
return self.__get_result()
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/pythonfutures/concurrent/futures/_base.py", line 356, in __get_result
raise self._exception
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/autoload/../python/ycm/unsafe_thread_pool_executor.py", line 43, in run
result = self.fn( *self.args, **self.kwargs )
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/adapters.py", line 437, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=51884): Max retries exceeded with url: /ready (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10adc8e10>: Failed to establish a new connection: [Errno 61] Connection refused'))
2018-08-04 09:47:04,089 - DEBUG - No global extra conf, not calling method YcmCorePreload
2018-08-04 09:47:04,179 - INFO - Received ready request
2018-08-04 09:47:05,165 - INFO - Received debug info request
2018-08-04 09:47:05,165 - ERROR - No semantic completer exists for filetypes: ['']
Traceback (most recent call last):
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 238, in DebugInfo
request_data ).DebugInfo( request_data )
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 302, in _GetCompleterForRequestData
return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] )
File "/Users/koomen/dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/server_state.py", line 90, in GetFiletypeCompleter
current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['']
serving on http://localhost:51898
macOS High Sierra @ v10.13.6
N/A
Thanks for building this awesome plugin! By far the most satisfying and best autocompleter I've had 馃憤 馃
The file path completer is file type agnostic, so I don't see anything specific to the jsx file type that could cause file path completer to stop working. Can you post your .tern-project file?
We disable fileoqth completer for jsx files by default.
See
https://github.com/Valloric/YouCompleteMe/blob/master/README.md#the-gycm_filepath_blacklist-option
You can tweak this option.
@puremourning Ah, thanks! but may I ask: why is jsx by default disabled? There is no reason for jsx to disable this so far I can think of.
https://github.com/Valloric/ycmd/pull/1061
Was the change which introduced it.
I understand it for only this part of the issue https://github.com/Valloric/YouCompleteMe/issues/3057 because it conflicts with a closing tag, but I do not have this issue because I use emmet.vim which auto closes html tags for me ;)
So my personal opinion would be: do not add jsx as a default on the path completion blacklist. Maybe provide a poll somewhere for people wether to implement this? Or maybe do a poll wether people use Emmet with YouCompleteMe, because using Emmet fixes this whole issue. I think the bigger population of vim users is using Emmet.
It's some feedback so just see what you'll do with it. Thanks in advance for the quick reply! :)
I think the bigger population of vim users is using Emmet.
I very much doubt it. But presented without evidence anyway.
There鈥檚 no way we could know. The option is there. If you change the default (I set it to {} because I alwyas want the filetype completer) then it will work for you.
We had a lot of people ask to disable it in htlml and other similar languages. So we did. It鈥檚 inevitable that would be bad for some users (like me) but we think it is good for a larger number of users so we favour that.
@kkoomen
Thanks for the information, but after added the following setting snippet into my ~/.vimrc file, filepath autocompletion is still unavailable in my editor:
let g:ycm_filepath_blacklist = {
\ 'jsx': 0,
\ 'html': 0,
\ 'xml': 0
\}
I even tried to set:
let g:ycm_filepath_blacklist = { '*': 0 }
But all of the above failed with no effect of filepath autocomplete, more verbose setup information would be appreciated, thanks in advance.
Ha... Right, because currently we only check if 'xml' in filepath_blacklist. So the value doesn't matter, only if a dictionary key exists or not.
For now let g:ycm_filepath_blacklist = {} does the trick.
Thanks @bstaletic it works.
Thanks @bstaletic! That was the only thing that worked.
Most helpful comment
We disable fileoqth completer for jsx files by default.
See
https://github.com/Valloric/YouCompleteMe/blob/master/README.md#the-gycm_filepath_blacklist-option
You can tweak this option.