richard1122 / vscode-youcompleteme

YouCompleteMe for VSCode
https://marketplace.visualstudio.com/items?itemName=RichardHe.you-complete-me
MIT License
53 stars 8 forks source link

No suggestions are shown #42

Closed shba24 closed 6 years ago

shba24 commented 7 years ago

I have been trying to make vscode-youcompleteme work for chromium code base, but its not even showing a single suggestion. Here is the settings.json file I am using.

{
  "editor.tabSize": 2,
  "editor.detectIndentation": false,
  "editor.rulers": [80],
  "editor.renderLineHighlight": "gutter",
  "editor.autoClosingBrackets": false,
  "editor.minimap.enabled": true,
  "editor.minimap.maxColumn": 80,
  "editor.minimap.renderCharacters": false,
  "files.trimTrailingWhitespace": true,
  "workbench.editor.enablePreview": false,
  "workbench.editor.enablePreviewFromQuickOpen": false,

  "files.associations": {
    "*.grd" : "xml",
    "*.gni" : "javascript",
    "*.gn" : "javascript"
  },

  "files.exclude": {
    "out*/**": true
  },

  "files.watcherExclude": {
    "**/out*/**": true,
    "**/third_party/**": true
  },
  "annotator.annotationColumnWidth": "24em",

  "C_Cpp.clang_format_path": "C:/etc/depot_tools/clang-format",
  "C_Cpp.clang_format_sortIncludes": true,
  "C_Cpp.clang_format_formatOnSave": true,
  "git.autorefresh": false,
  "C_Cpp.autocomplete": "Disabled",
  "C_Cpp.addWorkspaceRootToIncludePath": false,
  "ycmd.path": "C:/Users/in3o/vimfiles/bundle/YouCompleteMe/third_party/ycmd",
  "ycmd.global_extra_config": "F:/chromium/src/tools/vim/chromium.ycm_extra_conf.py",
  "ycmd.confirm_extra_conf": false
}
shba24 commented 7 years ago

Here is the log I am getting again and again on windows.

[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":false,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"F:/chromium/src/tools/vim/chromium.ycm_extra_conf.py","lint_run":"onCall","path":"C:/Users/in3o/vimfiles/bundle/YouCompleteMe/third_party/ycmd","python":"python","use_imprecise_get_type":false}}
[getInstance] ycm is restarting
[onDidOpen] file:///f%3A/chromium/src/sandbox/win/src/sidestep_resolver.h
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///f%3A/chromium/src/sandbox/win/src/sidestep_resolver.h"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///f%3A/chromium/src/sandbox/win/src/sidestep_resolver.h"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 59978
[start] random secret: 62ed48945cc9d0b596f73f6238926275
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"F:/chromium/src/tools/vim/chromium.ycm_extra_conf.py","confirm_extra_conf":false,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"Yu1IlFzJ0LWW9z9iOJJidQ==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: C:\Users\in3o\AppData\Local\Temp\VSCodeYcmOptions-1497472208775
[_start] [ '/s',
  '/d',
  '/c',
  '""python" "C:\\Users\\in3o\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\ycmd" "--port=59978" "--options_file=C:\\Users\\in3o\\AppData\\Local\\Temp\\VSCodeYcmOptions-1497472208775" "--idle_suicide_seconds=600""' ]
[_start] process spawn success 19784
[ycm stderr] The system cannot find the path specified.

[_start exit] 1
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 19784
[buildRequest] document, f:\chromium\src\sandbox\win\src\sidestep_resolver.h; position: null; event: BufferVisit
[_request] {"filepath":"f:\\chromium\\src\\sandbox\\win\\src\\sidestep_resolver.h","working_dir":"f:\\chromium\\src","file_data":{"f:\\chromium\\src\\sandbox\\win\\src\\sidestep_resolver.h":{"contents":"// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#ifndef SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n#define SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n\n#include <stddef.h>\n\n#include \"base/macros.h\"\n#include \"sandbox/win/src/nt_internals.h\"\n#include \"sandbox/win/src/resolver.h\"\n\nnamespace sandbox {\n\n// This is the concrete resolver used to perform sidestep interceptions.\nclass SidestepResolverThunk : public ResolverThunk {\n public:\n  SidestepResolverThunk() {}\n  ~SidestepResolverThunk() override {}\n\n  // Implementation of Resolver::Setup.\n  NTSTATUS Setup(const void* target_module,\n                 const void* interceptor_module,\n                 const char* target_name,\n                 const char* interceptor_name,\n                 const void* interceptor_entry_point,\n                 void* thunk_storage,\n                 size_t storage_bytes,\n                 size_t* storage_used) override;\n\n  // Implementation of Resolver::GetThunkSize.\n  size_t GetThunkSize() const override;\n\n private:\n  DISALLOW_COPY_AND_ASSIGN(SidestepResolverThunk);\n};\n\n// This is the concrete resolver used to perform smart sidestep interceptions.\n// This means basically a sidestep interception that skips the interceptor when\n// the caller resides on the same dll being intercepted. It is intended as\n// a helper only, because that determination is not infallible.\nclass SmartSidestepResolverThunk : public SidestepResolverThunk {\n public:\n  SmartSidestepResolverThunk() {}\n  ~SmartSidestepResolverThunk() override {}\n\n  // Implementation of Resolver::Setup.\n  NTSTATUS Setup(const void* target_module,\n                 const void* interceptor_module,\n                 const char* target_name,\n                 const char* interceptor_name,\n                 const void* interceptor_entry_point,\n                 void* thunk_storage,\n                 size_t storage_bytes,\n                 size_t* storage_used) override;\n\n  // Implementation of Resolver::GetThunkSize.\n  size_t GetThunkSize() const override;\n\n private:\n  // Performs the actual call to the interceptor if the conditions are correct\n  // (as determined by IsInternalCall).\n  static void SmartStub();\n\n  // Returns true if return_address is inside the module loaded at base.\n  static bool IsInternalCall(const void* base, void* return_address);\n\n  DISALLOW_COPY_AND_ASSIGN(SmartSidestepResolverThunk);\n};\n\n}  // namespace sandbox\n\n\n#endif  // SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[_request] req.end called
[buildRequest] document, f:\chromium\src\sandbox\win\src\sidestep_resolver.h; position: [object Object]; event: null
[_request] {"filepath":"f:\\chromium\\src\\sandbox\\win\\src\\sidestep_resolver.h","working_dir":"f:\\chromium\\src","file_data":{"f:\\chromium\\src\\sandbox\\win\\src\\sidestep_resolver.h":{"contents":"// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#ifndef SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n#define SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n\n#include <stddef.h>\n\n#include \"base/macros.h\"\n#include \"sandbox/win/src/nt_internals.h\"\n#include \"sandbox/win/src/resolver.h\"\n\nnamespace sandbox {\n\n// This is the concrete resolver used to perform sidestep interceptions.\nclass SidestepResolverThunk : public ResolverThunk {\n public:\n  SidestepResolverThunk() {}\n  ~SidestepResolverThunk() override {}\n\n  // Implementation of Resolver::Setup.\n  NTSTATUS Setup(const void* target_module,\n                 const void* interceptor_module,\n                 const char* target_name,\n                 const char* interceptor_name,\n                 const void* interceptor_entry_point,\n                 void* thunk_storage,\n                 size_t storage_bytes,\n                 size_t* storage_used) override;\n\n  // Implementation of Resolver::GetThunkSize.\n  size_t GetThunkSize() const override;\n\n private:\n  DISALLOW_COPY_AND_ASSIGN(SidestepResolverThunk);\n};\n\n// This is the concrete resolver used to perform smart sidestep interceptions.\n// This means basically a sidestep interception that skips the interceptor when\n// the caller resides on the same dll being intercepted. It is intended as\n// a helper only, because that determination is not infallible.\nclass SmartSidestepResolverThunk : public SidestepResolverThunk {\n public:\n  SmartSidestepResolverThunk() {}\n  ~SmartSidestepResolverThunk() override {}\n\n  // Implementation of Resolver::Setup.\n  NTSTATUS Setup(const void* target_module,\n                 const void* interceptor_module,\n                 const char* target_name,\n                 const char* interceptor_name,\n                 const void* interceptor_entry_point,\n                 void* thunk_storage,\n                 size_t storage_bytes,\n                 size_t* storage_used) override;\n\n  // Implementation of Resolver::GetThunkSize.\n  size_t GetThunkSize() const override;\n\n private:\n  // Performs the actual call to the interceptor if the conditions are correct\n  // (as determined by IsInternalCall).\n  static void SmartStub();\n\n  // Returns true if return_address is inside the module loaded at base.\n  static bool IsInternalCall(const void* base, void* return_address);\n\n  DISALLOW_COPY_AND_ASSIGN(SmartSidestepResolverThunk);\n};\n\n}  // namespace sandbox\n\n\n#endif  // SANDBOX_SRC_SIDESTEP_RESOLVER_H__\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[_request] req.end called
[!!!uncaughtException!!!] { Error: connect ECONNREFUSED 127.0.0.1:59978
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 59978 }
[!!!uncaughtException!!!] { Error: socket hang up
    at createHangUpError (_http_client.js:253:15)
    at Socket.socketCloseListener (_http_client.js:285:23)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:501:12) code: 'ECONNRESET' }
[!!!uncaughtException!!!] { Error: connect ECONNREFUSED 127.0.0.1:59978
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 59978 }
[!!!uncaughtException!!!] { Error: socket hang up
    at createHangUpError (_http_client.js:253:15)
    at Socket.socketCloseListener (_http_client.js:285:23)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:501:12) code: 'ECONNRESET' }

Looks like ycmd doesn't work on windows, I guess.

richard1122 commented 7 years ago

Hi, Ycmd is working on windows (also Windows is the platform I developed this extension on).

There might be some problems when ycmd is initializing:

[_start] process spawn success 19784
[ycm stderr] The system cannot find the path specified.

[_start exit] 1

But I don't know what exactly it is.

Have you tried some smaller project or very simple code to see if it works?

shba24 commented 7 years ago

Found the issue and stumbled into another one.

Above issue is because of this line https://github.com/richard1122/vscode-youcompleteme/blob/master/server/src/ycm.ts#L89 .

let cmd = this.settings.ycmd.python

Here cmd is python by default. So at line https://github.com/richard1122/vscode-youcompleteme/blob/master/server/src/ycm.ts#L110 , process spawned command line comes out as :

""python" "C:\\Users\\in3o\\vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\ycmd" "--port=54594" "--options_file=C:\\Users\\in3o\\AppData\\Local\\Temp\\VSCodeYcmOptions-1497537938324" "--idle_suicide_seconds=600""

which is incorrect as "python" is never resolved to c:\python27\python.exe, which gives the file not found error above. So, all I did is added "ycmd.python" : "C:/Python27/python.exe" to my settings.json file. And it works.

shba24 commented 7 years ago

Now, time for another issue which I am facing right now. On starting vscode, server and everything starts perfectly but after some time I get an error like this : jit_error

Can you help with this?

I did python build.py --msvc 14 --clang-completer to build ycmd.

richard1122 commented 7 years ago

I think there are some issues with Ycmd or clang on Windows.

When I checkout the latest code of ycmd and build, It produces errors sometimes.

But It works fine about a month ago.

I guess they will fix these soon, Or maybe you could checkout the code few months ago and build it ?

shba24 commented 7 years ago

Okay. If you could help me with the date of it last working, then it would be awesome.

iperez319 commented 7 years ago

From where did you get the log?

richard1122 commented 6 years ago

@yoyomanyoyo87 Set ycmd.debug in your vscode preferences and view the output panel.