niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4
https://niosus.github.io/EasyClangComplete/
MIT License
575 stars 79 forks source link

Syntax C99 is not supported #102

Closed lukehayes closed 7 years ago

lukehayes commented 7 years ago

I have gotten the autocompletion to work really well for C++ but when I switch to a C project, there is no autocompletion at all.

What am I doing wrong?

niosus commented 7 years ago

hmm. Depends on what you are doing. Can you please specify, the system you are running, which sublime text you're on and what exactly you do.

I have never used my plugin for c autocompletion, but there were other people that did. So theoretically it works, but if it doesn't for you, let's figure this out.

Please set verbose flag to true in the settings of the plugin and copy the full log from the console from the moment you open sublime text to the moment when you try to autocomplete something. Just copy the log here. Then we'll be able to see what is happening.

niosus commented 7 years ago

Please provide some details. I would need more specifics here. It works with c just fine on my side.

lukehayes commented 7 years ago

Thanks for getting back to me and sorry for the delay!

So: sublime text version: Build 3126, I just updated from the previous version and it still is not working for me. OS: OSX Yosemite 10.10.3

Have all the settings set to how they are in the instructions.

I turned verbose on and I have this message in the console:

WARNING:process:Could not import subprocess32 module, falling back to subprocess module

Essentially all I'm doing atm the moment is playing around with SDL and I can't get any of the functions to autocomplete like they do for c++ when I start typing. This is also the same for including headers (but I'm not sure if its meant to do that).

Im probably just missing something a small detail - its promising it works for you though :)

niosus commented 7 years ago

Ok, SDL seems to be quite some project. Can you confirm that it doesn't work for a very small example?

The message that you posted should not cause any trouble.

So, I would suggest you to create a very small file test.c and try to complete some custom struct there. Also, while at it, please copy full log here - this might give me a hint on what is happening on your side.

lukehayes commented 7 years ago

I tried a very small project:

#include <stdio.h>

 typedef struct
 {
     int bar;
 } Foo;

 int main()
 {

    Foo f = {10};
    printf("%i \n ", f.bar);

    return 0;
 }

And I can't get any completion.

I didn't realise the log was longer - here it is:

_Edited, need verbose log_

lukehayes commented 7 years ago

I had a double check and added verbose to the actual plugins preferences instead. I didn't know each plugin has its own settings.

I hope this is better:

startup, version: 3126 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/lukehayes/Library/Application Support/Sublime Text 3/Packages
state path: /Users/lukehayes/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/lukehayes/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["ActionScript", "C#", "C++ Starting Kit", "SublimeLinter-jshint"]
ignoring deprecated syntax definition: Packages/Ruby on Rails snippets/HTML (Rails).tmLanguage
pre session restore time: 0.505937
first paint time: 0.576444
startup time: 0.592324
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin Vintage.vintage
reloading plugin Vintage.vintage_commands
reloading plugin Vintage.vintage_motions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-backrefs
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin BracketHighlighter.bh_core
Unable to find cancel_build command: exec
Unable to find cancel_build command: exec
reloading plugin BracketHighlighter.bh_logging
reloading plugin BracketHighlighter.bh_plugin
reloading plugin BracketHighlighter.bh_regions
reloading plugin BracketHighlighter.bh_remove
reloading plugin BracketHighlighter.bh_rules
reloading plugin BracketHighlighter.bh_search
reloading plugin BracketHighlighter.bh_swapping
reloading plugin BracketHighlighter.bh_wrapping
reloading plugin BracketHighlighter.changes
reloading plugin BracketHighlighter.support
reloading plugin Colorsublime.colorsublime-plugin
reloading plugin Composer.composer
some modules could not be inported (it is ok if using ST3
reloading plugin Composer.composer_st3
reloading plugin DocBlockr.jsdocs
reloading plugin Emmet.emmet-plugin
reloading plugin Git.git_commands
reloading plugin Lua Love.ParseLua
reloading plugin Material Theme.MT
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
Unable to find cancel_build command: exec
Unable to find cancel_build command: exec
reloading plugin Package Control.Package Control
reloading plugin PackageResourceViewer.package_resource_viewer
reloading plugin PackageResourceViewer.package_resources
reloading plugin PhpDoc.CodeDoc
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading plugin Vintageous.__init__
reloading plugin Vintageous.dev_cmds
reloading plugin Vintageous.ex_commands
reloading plugin Vintageous.ex_main
reloading plugin Vintageous.ex_motions
reloading plugin Vintageous.jump_list_cmds
reloading plugin Vintageous.modelines
reloading plugin Vintageous.state
reloading plugin Vintageous.test_runner
reloading plugin Vintageous.xactions
reloading plugin Vintageous.xmotions
reloading plugin Vintageous.xsupport
reloading plugin Vintageous.xsupport_mouse
reloading plugin EasyClangComplete.EasyClangComplete
reloading plugin Gulp.base_command
reloading plugin Gulp.caches
reloading plugin Gulp.cross_platform_codecs
reloading plugin Gulp.cross_platform_process
reloading plugin Gulp.dir_context
reloading plugin Gulp.event_task
reloading plugin Gulp.gulp
reloading plugin Gulp.gulp_version
reloading plugin Gulp.hasher
reloading plugin Gulp.insert_in_output_view
reloading plugin Gulp.plugins
reloading plugin Gulp.progress_notifier
reloading plugin Gulp.settings
reloading plugin Gulp.timeout
reloading plugin Jedi - Python autocompletion.__init__
reloading plugin SublimeCodeIntel.ordereddict
reloading plugin SublimeCodeIntel.SublimeCodeIntel
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
reloading plugin TypeScript.main
2016-10-30 17:52:26,701: 140735268688640: WARNING: TypeScript plugin initialized.
WARNING:TS:TypeScript plugin initialized.
plugins loaded
Path of tsserver.js: /Users/lukehayes/Library/Application Support/Sublime Text 3/Packages/TypeScript/tsserver/tsserver.js
Path of tsc.js: /Users/lukehayes/Library/Application Support/Sublime Text 3/Packages/TypeScript/tsserver/tsc.js
Trying to spawn node executable from: /usr/local/bin/node
SublimeLinter: debug mode: off 
lang_service_enabled: True
Path of tsserver.js: /Users/lukehayes/Library/Application Support/Sublime Text 3/Packages/TypeScript/tsserver/tsserver.js
Path of tsc.js: /Users/lukehayes/Library/Application Support/Sublime Text 3/Packages/TypeScript/tsserver/tsc.js
Trying to spawn node executable from: /usr/local/bin/node
ref view not found
--------- <sublime.Settings object at 0x10636fe10> ----------
False
True
True
./composer.phar
composer.json
['-n', '-v']
['-n', '-v']
['-n', '-v']
['-n', '-v']
['-n', '-v']
['-n', '-v']
INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `clang++ -v`
WARNING:EasyClangComplete.plugin.completion.base_complete: OSX version 6.1 reported. Reducing it to 3.6. Info: {'platform': 'Darwin'}
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.6
DEBUG:EasyClangComplete.plugin.completion.lib_complete: using bundled cindex: EasyClangComplete.clang.cindex36
DEBUG:EasyClangComplete.clang.utils: platform: ('64bit', '')
DEBUG:EasyClangComplete.clang.utils: python version: 3.3.6
INFO:EasyClangComplete.clang.utils: we are on 'Darwin'
INFO:EasyClangComplete.clang.utils: searching for: 'libclang.dylib'
INFO:EasyClangComplete.clang.utils: libclang search output = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0'
DEBUG:EasyClangComplete.clang.utils: real output: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0
DEBUG:EasyClangComplete.clang.utils: folder to search: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/../..
INFO:EasyClangComplete.clang.utils: found libclang dir: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/../..'
INFO:EasyClangComplete.clang.utils: found library file: 'libclang.dylib'
ERROR:EasyClangComplete.plugin.completion.lib_complete: error: dlsym(0x7fbd48e84e70, clang_Cursor_getNumTemplateArguments): symbol not found. Please ensure that your python bindings are compatible with your libclang.so version.
ERROR:EasyClangComplete.EasyClangComplete: cannot initialize completer with libclang.
INFO:EasyClangComplete.EasyClangComplete: falling back to using clang in a subprocess.
INFO:EasyClangComplete.EasyClangComplete: init completer based on clang from cmd
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `clang++ -v`
WARNING:EasyClangComplete.plugin.completion.base_complete: OSX version 6.1 reported. Reducing it to 3.6. Info: {'platform': 'Darwin'}
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.6
DEBUG:EasyClangComplete.EasyClangComplete: on_activated_async view id 28
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
Emmet: No need to update PyV8
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
Package Control: Skipping automatic upgrade, last run at 2016-10-30 17:42:11, next run at 2016-10-30 18:42:11 or after
WARNING:process:Could not import subprocess32 module, falling back to subprocess module
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.EasyClangComplete: on_query_completions view id 28
DEBUG:EasyClangComplete.EasyClangComplete: prefix: f, locations: [151]
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.EasyClangComplete: not a valid view
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.plugin.tools: file has unsupported syntax: `C99`
DEBUG:EasyClangComplete.EasyClangComplete: on_activated_async view id 5
niosus commented 7 years ago

Ah, ok, you have syntax defined as C99 (bottom right corner of editor with a file opened). This one is not supported yet. You can try to open them as C or C++ and check if it works. I will add support for this syntax identifier as soon as I finish with the two pending pull requests.

lukehayes commented 7 years ago

Ah awesome, setting the syntax to c++ works for me.

Thanks for your help with getting this sorted out :)

niosus commented 7 years ago

Ok, I will close this as soon as I add C99 to supported synax