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

Headers autocompletion suggestion #743

Open
Feacur opened this issue Apr 12, 2021 · 3 comments
Open

Headers autocompletion suggestion #743

Feacur opened this issue Apr 12, 2021 · 3 comments

Comments

@Feacur
Copy link

Feacur commented Apr 12, 2021

probably related to: #705 and #706?

UPD: added some more new completion triggers

System info:

  • Sublime Text version: Version 3.2.2, Build 3211
  • Which system are you on: Windows 10 Home, 10.0.19042 Build 19042
  • Clang version: 10, x86_64-pc-windows-msvc, posix

What happens:

More of a suggestion, than an issue.

Using libclang to complete #include "..." feels more natural and correct than the original popup method.

A small tweak is sufficient:

// - disable `autocomplete_includes`
// - add `"`, `<`, and `/` to `triggers`
// UPD: add a `)` for correct completions of `(type)variable_name`
// UPD: add an `&` for correct completions of `&variable_name`
// UPD: add a `*` for correct completions of `*variable_name`
"autocomplete_includes": false,
"triggers" : [ ".", "->", "::", " ", "\t", "(", ")", "[", "&", "*", "\"", "<", "/" ],

... A correct -I flags setup is implied, of course.

Original method:

But first, notice how the popup completion behaves:

... forbids inner relative paths:
image

... requires fully-qualified ones, relative to the project's root
image

... also no text appears until a header is selected
image

... besides, it generates paths with backslashes
image

Log that illustrates the issue (with the original method):
DPI mode: per-monitor v2
startup, version: 3211 windows x64 channel: stable
executable: /C/Program Files/Sublime Text 3/sublime_text.exe
working dir: /C/Program Files/Sublime Text 3
packages path: /C/Users/Feacu/AppData/Roaming/Sublime Text 3/Packages
state path: /C/Users/Feacu/AppData/Roaming/Sublime Text 3/Local
zip path: /C/Program Files/Sublime Text 3/Packages
zip path: /C/Users/Feacu/AppData/Roaming/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.156227
startup time: 0.264227
first paint time: 0.268227
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
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.rename
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.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.01-sublime_lib
reloading plugin 0_package_control_loader.10-wcwidth
reloading plugin 0_package_control_loader.40-pywinpty
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-pathlib
reloading plugin 0_package_control_loader.50-pymdownx
reloading plugin 0_package_control_loader.50-pyte
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin BuildX.ansi
reloading plugin BuildX.buildx
reloading plugin BuildX.test-color-scheme
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 125, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1199, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "C:\Users\Feacu\AppData\Roaming\Sublime Text 3\Installed Packages\BuildX.sublime-package\test-color-scheme.py", line 5
    print(f"\x1b[0m\x1b[{code}m{name}\x1b[0m")
                                            ^
SyntaxError: invalid syntax
reloading plugin HexViewer.hex_checksum
reloading plugin HexViewer.hex_common
reloading plugin HexViewer.hex_editor
reloading plugin HexViewer.hex_finder
reloading plugin HexViewer.hex_highlighter
reloading plugin HexViewer.hex_inspector
reloading plugin HexViewer.hex_notify
reloading plugin HexViewer.hex_viewer
reloading plugin HexViewer.hex_writer
reloading plugin HexViewer.sum_hashes
reloading plugin HexViewer.support
reloading plugin HexViewer.tiger
reloading plugin HexViewer.whirlpool
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin PackageDev._logging
reloading plugin PackageDev.main
reloading plugin ProjectManager.json_file
reloading plugin ProjectManager.project_manager
reloading plugin SyncedSideBar.SyncedSideBar
reloading plugin Terminus.main
reloading plugin EasyClangComplete.EasyClangComplete
reloading plugin User.plugins
plugins loaded
[ECC:DEBUG]:[settings_storage.py]:[need_reparse]:[MainThread]: settings complete
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[MainThread]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[MainThread]: view file_name is None
git: tracking working dir F:\Projects\game_prototype
[ECC:DEBUG]:[EasyClangComplete.py]:[on_modified_async]:[Dummy-5]: on_modified_async view id 33
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[settings_manager.py]:[settings_for_view]:[Dummy-5]: no settings for view 33. Reinitializing.
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: Overriding settings by project ones if needed:
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: Valid prefixes: ['ecc_', 'easy_clang_complete_']
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: Reading settings...
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: common_flags               <-- '['-std=c99', '-Werror', '-Weverything', '-Wno-switch-enum', '-Wno-float-equal', '-Wno-reserved-id-macro', '-Wno-nonportable-system-include-path', '-Wno-assign-enum', '-Wno-bad-function-cast', '-I..', '-I../third_party', '-DGAME_TARGET_DEBUG', '-D_CRT_SECURE_NO_WARNINGS', '-DWIN32_LEAN_AND_MEAN', '-DNOMINMAX', '-DUNICODE']'
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: force_unix_includes        <-- 'True'
[ECC:DEBUG]:[settings_storage.py]:[__load_vars_from_settings]:[Dummy-5]: Settings sucessfully read...
[ECC:DEBUG]:[file.py]:[expand_all]:[Dummy-5]: Populated 'C:/Program Files/LLVM/bin/clang.exe' to '['C:\\Program Files\\LLVM\\bin\\clang.exe']'
[ECC:INFO]:[clang_utils.py]:[get_clang_version_str]:[Dummy-5]: Getting version from command: `C:\Program Files\LLVM\bin\clang.exe -v`
[ECC:DEBUG]:[settings_storage.py]:[__populate_common_flags]:[Dummy-5]: Populating common_flags with current variables.
[ECC:DEBUG]:[file.py]:[expand_all]:[Dummy-5]: Populated '..' to '['F:\\Projects\\game_prototype']'
[ECC:DEBUG]:[file.py]:[expand_all]:[Dummy-5]: Populated '../third_party' to '['F:\\Projects\\game_prototype\\third_party']'
[ECC:CRITICAL]:[settings_storage.py]:[__populate_flags_source_paths]:[Dummy-5]:  Cannot update paths of flag sources.
[ECC:CRITICAL]:[settings_storage.py]:[update_from_view]:[Dummy-5]: Cannot expand ignore_list
[ECC:CRITICAL]:[settings_storage.py]:[update_from_view]:[Dummy-5]: Cannot expand ignore_flags
[ECC:CRITICAL]:[settings_storage.py]:[update_from_view]:[Dummy-5]: Cannot expand header_to_source_mapping
[ECC:DEBUG]:[settings_manager.py]:[__init_for_view]:[Dummy-5]: settings initialized for view: 33
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[view_config_manager.py]:[load_for_view]:[Thread-7]: Generate new config for path: 33
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:INFO]:[view_config.py]:[__init_completer]:[Thread-7]: init completer based on libclang
[ECC:DEBUG]:[lib_complete.py]:[__init__]:[Thread-7]: using bundled cindex: EasyClangComplete.plugin.clang.cindex50
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Platform: Windows, ('64bit', 'WindowsPE')
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Python version: 3.3.6
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: User provided libclang_path: '<some_path_here>'
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Searching for: 'libclang.dll'
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Generating search folder
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[thread_pool.py]:[new_job]:[Dummy-5]: Cannot cancel job: 'job: 'Updating translation unit''
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[thread_pool.py]:[new_job]:[Dummy-5]: Cannot cancel job: 'job: 'Updating translation unit''
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Dummy-5]: could not update config -> cancelled
[ECC:DEBUG]:[thread_pool.py]:[new_job]:[Dummy-5]: Canceled job: 'job: 'Updating translation unit''
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[thread_pool.py]:[new_job]:[Dummy-5]: Cannot cancel job: 'job: 'Updating translation unit''
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Dummy-5]: could not update config -> cancelled
[ECC:DEBUG]:[thread_pool.py]:[new_job]:[Dummy-5]: Canceled job: 'job: 'Updating translation unit''
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Libclang search output = 'C:\Program Files\LLVM\bin\clang'
[ECC:DEBUG]:[clang_utils.py]:[dir_from_output]:[Thread-7]: Real output: C:\Program Files\LLVM\bin\clang
[ECC:DEBUG]:[clang_utils.py]:[dir_from_output]:[Thread-7]: Architecture: ('64bit', 'WindowsPE')
[ECC:DEBUG]:[clang_utils.py]:[dir_from_output]:[Thread-7]: Folder to search: C:\Program Files\LLVM\bin\clang\..
[ECC:DEBUG]:[clang_utils.py]:[find_libclang]:[Thread-7]: Checking path: C:\Program Files\LLVM\bin\libclang.dll
[ECC:INFO]:[clang_utils.py]:[find_libclang]:[Thread-7]: Found libclang library file: 'C:\Program Files\LLVM\bin\libclang.dll'
[ECC:DEBUG]:[view_config.py]:[__get_default_flags]:[Thread-7]: Tokeninzing default flags
[ECC:DEBUG]:[flag.py]:[tokenize_list]:[Thread-7]: Tokenizing: ['-x', 'c', '-std=c99']
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Common
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Source
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Merge
[ECC:DEBUG]:[view_config.py]:[__merge_flags]:[Thread-7]: lang flags: [(-x c), (-std=c99)]
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Appending and filtering flags with ignore patterns: []
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: view is 33
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: translation unit does not exist. Creating.
[ECC:DEBUG]:[lib_complete.py]:[parse_tu]:[Thread-7]: clang flags are: ['-c', '-fsyntax-only', '-x', 'c', '-std=c99', '-Werror', '-Weverything', '-Wno-switch-enum', '-Wno-float-equal', '-Wno-reserved-id-macro', '-Wno-nonportable-system-include-path', '-Wno-assign-enum', '-Wno-bad-function-cast', '-I', 'F:\\Projects\\game_prototype', '-I', 'F:\\Projects\\game_prototype\\third_party', '-DGAME_TARGET_DEBUG', '-D_CRT_SECURE_NO_WARNINGS', '-DWIN32_LEAN_AND_MEAN', '-DNOMINMAX', '-DUNICODE']
[ECC:DEBUG]:[lib_complete.py]:[parse_tu]:[Thread-7]: compilation started for view id: 33
[ECC:DEBUG]:[lib_complete.py]:[parse_tu]:[Thread-7]: compilation done in 0.05884099006652832 seconds
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: reparsing translation_unit for view 33
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: reparsed in 0.09877395629882812 seconds
[ECC:DEBUG]:[popup_error_vis.py]:[generate]:[Thread-7]: Generating error regions for view 33
[ECC:DEBUG]:[popup_error_vis.py]:[generate]:[Thread-7]: 1 error regions ready
[ECC:DEBUG]:[popup_error_vis.py]:[show_errors]:[Thread-7]: Showing error regions: [(8, 10), (8, 10), (37, 42), (84, 89)]
[ECC:DEBUG]:[popup_error_vis.py]:[show_errors]:[Thread-7]: Showing warning regions: []
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Thread-7]: updated config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[view_config_manager.py]:[load_for_view]:[Thread-7]: Config exists for path: 33
[ECC:INFO]:[view_config.py]:[__init_completer]:[Thread-7]: init completer based on libclang
[ECC:DEBUG]:[lib_complete.py]:[__init__]:[Thread-7]: using bundled cindex: EasyClangComplete.plugin.clang.cindex50
[ECC:DEBUG]:[view_config.py]:[__get_default_flags]:[Thread-7]: Tokeninzing default flags
[ECC:DEBUG]:[flag.py]:[tokenize_list]:[Thread-7]: Tokenizing: ['-x', 'c', '-std=c99']
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Common
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Source
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Merge
[ECC:DEBUG]:[view_config.py]:[__merge_flags]:[Thread-7]: lang flags: [(-x c), (-std=c99)]
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Appending and filtering flags with ignore patterns: []
[ECC:DEBUG]:[view_config.py]:[needs_update]:[Thread-7]: view config needs no update.
[ECC:DEBUG]:[file.py]:[is_unchanged]:[Thread-7]: never seen file 'F:\Projects\game_prototype\prototype\some_tu.c' before. Updating.
[ECC:DEBUG]:[view_config.py]:[update_if_needed]:[Thread-7]: config updates existing completer.
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: view is 33
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: reparsing translation_unit for view 33
[ECC:DEBUG]:[lib_complete.py]:[update]:[Thread-7]: reparsed in 0.0069429874420166016 seconds
[ECC:DEBUG]:[popup_error_vis.py]:[generate]:[Thread-7]: Generating error regions for view 33
[ECC:DEBUG]:[popup_error_vis.py]:[generate]:[Thread-7]: Removing old error regions
[ECC:DEBUG]:[popup_error_vis.py]:[generate]:[Thread-7]: 1 error regions ready
[ECC:DEBUG]:[popup_error_vis.py]:[show_errors]:[Thread-7]: Showing error regions: [(8, 10), (8, 10), (37, 42), (84, 89)]
[ECC:DEBUG]:[popup_error_vis.py]:[show_errors]:[Thread-7]: Showing warning regions: []
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Thread-7]: updated config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
Package Control: Skipping automatic upgrade, last run at 2021-04-12 21:34:18, next run at 2021-04-12 22:34:18 or after
[ECC:DEBUG]:[EasyClangComplete.py]:[on_modified_async]:[Dummy-5]: on_modified_async view id 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config exists for view: 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[popup_error_vis.py]:[erase_regions]:[Dummy-5]: Erasing error regions for view 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config exists for view: 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[MainThread]: config exists for view: 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[MainThread]: config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Going through: F:\Projects\game_prototype
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Going through: F:\Projects\game_prototype\third_party
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Includes completion list size: 16
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:DEBUG]:[include_parser.py]:[on_include_picked]:[MainThread]: Picked index: 13
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Going through: F:\Projects\game_prototype\prototype
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Includes completion list size: 3
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[view_config_manager.py]:[load_for_view]:[Thread-7]: Config exists for path: 33
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:INFO]:[view_config.py]:[__init_completer]:[Thread-7]: init completer based on libclang
[ECC:DEBUG]:[lib_complete.py]:[__init__]:[Thread-7]: using bundled cindex: EasyClangComplete.plugin.clang.cindex50
[ECC:DEBUG]:[view_config.py]:[__get_default_flags]:[Thread-7]: Tokeninzing default flags
[ECC:DEBUG]:[flag.py]:[tokenize_list]:[Thread-7]: Tokenizing: ['-x', 'c', '-std=c99']
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Common
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Source
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Merge
[ECC:DEBUG]:[view_config.py]:[__merge_flags]:[Thread-7]: lang flags: [(-x c), (-std=c99)]
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Appending and filtering flags with ignore patterns: []
[ECC:DEBUG]:[view_config.py]:[needs_update]:[Thread-7]: view config needs no update.
[ECC:DEBUG]:[view_config.py]:[needs_reparse]:[Thread-7]: view config needs no reparse.
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Thread-7]: updated config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[include_parser.py]:[on_include_picked]:[MainThread]: Picked index: 2
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Going through: F:\Projects\game_prototype\prototype\folder
[ECC:DEBUG]:[include_parser.py]:[__get_all_headers]:[Thread-7]: Includes completion list size: 2
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[view_config_manager.py]:[load_for_view]:[Thread-7]: Config exists for path: 33
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None
[ECC:INFO]:[view_config.py]:[__init_completer]:[Thread-7]: init completer based on libclang
[ECC:DEBUG]:[lib_complete.py]:[__init__]:[Thread-7]: using bundled cindex: EasyClangComplete.plugin.clang.cindex50
[ECC:DEBUG]:[view_config.py]:[__get_default_flags]:[Thread-7]: Tokeninzing default flags
[ECC:DEBUG]:[flag.py]:[tokenize_list]:[Thread-7]: Tokenizing: ['-x', 'c', '-std=c99']
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Common
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Source
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Merge
[ECC:DEBUG]:[view_config.py]:[__merge_flags]:[Thread-7]: lang flags: [(-x c), (-std=c99)]
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Appending and filtering flags with ignore patterns: []
[ECC:DEBUG]:[view_config.py]:[needs_update]:[Thread-7]: view config needs no update.
[ECC:DEBUG]:[view_config.py]:[needs_reparse]:[Thread-7]: view config needs no reparse.
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Thread-7]: updated config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[include_parser.py]:[on_include_picked]:[MainThread]: Picked index: 1
[ECC:DEBUG]:[EasyClangComplete.py]:[on_activated_async]:[Dummy-5]: on_activated_async view id 33
[ECC:DEBUG]:[view_config_manager.py]:[load_for_view]:[Thread-7]: Config exists for path: 33
[ECC:DEBUG]:[EasyClangComplete.py]:[on_modified_async]:[Dummy-5]: on_modified_async view id 33
[ECC:INFO]:[view_config.py]:[__init_completer]:[Thread-7]: init completer based on libclang
[ECC:DEBUG]:[lib_complete.py]:[__init__]:[Thread-7]: using bundled cindex: EasyClangComplete.plugin.clang.cindex50
[ECC:DEBUG]:[view_config.py]:[__get_default_flags]:[Thread-7]: Tokeninzing default flags
[ECC:DEBUG]:[flag.py]:[tokenize_list]:[Thread-7]: Tokenizing: ['-x', 'c', '-std=c99']
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Common
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Source
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Merge
[ECC:DEBUG]:[view_config.py]:[__merge_flags]:[Thread-7]: lang flags: [(-x c), (-std=c99)]
[ECC:DEBUG]:[view_config.py]:[__generate_essentials]:[Thread-7]: Appending and filtering flags with ignore patterns: []
[ECC:DEBUG]:[view_config.py]:[needs_update]:[Thread-7]: view config needs no update.
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config exists for view: 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[view_config.py]:[needs_reparse]:[Thread-7]: view config needs no reparse.
[ECC:DEBUG]:[EasyClangComplete.py]:[config_updated]:[Thread-7]: updated config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config exists for view: 33
[ECC:DEBUG]:[view_config_manager.py]:[get_from_cache]:[Dummy-5]: config: <EasyClangComplete.plugin.view_config.view_config.ViewConfig object at 0x0000026A00DAB0B8>
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-5]: view file_name is None

Suggestion:

this allows typing whatever the user needs:
image

...
image

...
image

Verbose log was too verbose, though: suggestion.log

A minimal repro:

A repository of mine as a reference: https://github.com/Feacur/game_prototype/tree/master/__sublime_project

./folder/some_header1.h

#if !defined(SOME_HEADER1)
#define SOME_HEADER1

void func1(void);

#endif

./folder/some_header2.h

#if !defined(SOME_HEADER2)
#define SOME_HEADER2

void func2(void);

#endif

./some_tu.c

#include "folder/some_header1.h"
#include "folder/..." // fix me

#include <stdio.h>

void func1(void) { printf("hello, world1!"); }
void func2(void) { printf("hello, world2!"); }

int main (int argc, char const * argv[]) {
	(void)argc; (void)argv;
	return 0;
}

P.S.:

both methods struggle in the presence of extra symbols:
image

... or by being super-eager to auto-complete:
image

... when there's no ambiguity:
image

... or eats a completion (puts emptiness/ignores) if a name matches the end of a previous folder name:
image
the log is here, btw: emptiness.log
UPD: LSP + clangd acts just alike.

otoh, you can complete paths right in the middle!
image

... would be cool [probably] if this kind of completion optionally removed the rest of the line, but ctrl + shift + delete already capable of that anyway.

@niosus
Copy link
Owner

niosus commented Apr 18, 2021

Holy crap. I was never aware that I could just get the includes from libclang. 🤦‍♂️ The funny thing is that I believe I tried this before and it never worked. I just tested this and it works well. Soooo. This makes my way of completing the includes with the popup obsolete to some degree. 🤔

That being said, let me quickly walk through how each of the methods works:

  • my popup method remembers all the folders from the include flags and will suggest those when completing includes in an interactive manner. What I like about it is that it will have only the folders from the include folders provided and guides the user through the folders and files to choose.
  • the libclang method would kinda do the same, just using the normal completion dialog. One needs to start typing every single folder or file and do it sequentially, first the folders, then eventually the file.

So, from the looks of it, I would still prefer the new method, so I will probably leave it as default. But I will extend the completion triggers so that they can be used out of the box and change the name of the setting probably.

How does it sound?

@Feacur
Copy link
Author

Feacur commented Apr 18, 2021

Sounds great to extend the defaults and rephrase the setting! Though, surely, that's completely up to you whether to make the libclang method default instead or not. I merely wanted to bring the possibility up.

@stale
Copy link

stale bot commented Apr 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just comment here to prevent this from happening.

@stale stale bot added the wontfix label Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants