Ticket #4160 (closed enhancement: fixed)
Add option to complete words from all open files
Reported by: | psprint | Owned by: | andrew_b |
---|---|---|---|
Priority: | major | Milestone: | 4.8.27 |
Component: | mcedit | Version: | master |
Keywords: | completion | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
Hi,
I submit a patch that adds a new option to mcedit: editor_wordcompletion_collect_all_files which, when enabled, works as follows:
– normally when editing a file A and requesting a completion one gets candidates only from the same file A,
– other open files aren't searched,
– this option changes that – it makes the completion engine to provide candidates from all currently open files.
I think that it's a more usable scenario. All other editors like Vim complete in this way. I'm editing quite much in mcedit and have been hitting the *same buffer* limitation often so that I've decided to submit a patch. I've made the option enabled by default.
Attachments
Change History
Changed 4 years ago by psprint
- Attachment 0001-Add-an-option-to-complete-words-from-all-open-files-.patch added
comment:1 Changed 4 years ago by andrew_b
- Milestone changed from 4.8.26 to Future Releases
If you offer your patches for some project, please stick to the coding style of that project.
comment:4 Changed 4 years ago by psprint
I don't contribute often and I forgot about such style rules, getting my hands wet... I'll send an updated patch later today.
comment:5 follow-up: ↓ 6 Changed 4 years ago by psprint
I've fixed the indentation and coding style. The option name is now editor_wordcompletion_collect_other_files (it was: …_all_files). It is by default set to true. The other option, editor_wordcompletion_collect_entire_file, is also default true now. I think that the defaults should be the ones that are most useful ones, and for the completion that's to complete from all files, period. So that the completion is like in the other, competing editors like vim or emacs.
PS. The completion list is now also made unique, so that the multiple occurrences (in multiple files) of a symbol are filtered out.
Changed 4 years ago by psprint
- Attachment CompleteAllFiles_v2-1.patch added
complete from all open buffers by default
comment:6 in reply to: ↑ 5 Changed 4 years ago by andrew_b
Replying to psprint:
I've fixed the indentation and coding style. The option name is now editor_wordcompletion_collect_other_files (it was: …_all_files). It is by default set to true.
New option isn't documented in man page.
The other option, editor_wordcompletion_collect_entire_file, is also default true now.
This is independent change. Please move it to separate patch (no need in creation of new ticket for that).
comment:7 Changed 4 years ago by psprint
Here's a patch that makes the editor_wordcompletion_entire_file option enabled by default. And an updated main patch.
Changed 4 years ago by psprint
- Attachment AllFilesCompletion_v3.patch added
no change of other options
Changed 4 years ago by psprint
- Attachment AllFilesComplete_v3.1_with_man.patch added
includes manpage documentation on the new option
comment:8 Changed 4 years ago by andrew_b
- Status changed from new to accepted
- Owner set to andrew_b
- Branch state changed from no branch to on review
- Milestone changed from Future Releases to 4.8.27
Branch: 4160_complete_all_files
Initial changeset:4779b400a726f885b841a6b31769ed6490890081
Please test.
comment:9 Changed 4 years ago by andrew_b
- Votes for changeset set to andrew_b
- Branch state changed from on review to approved
comment:10 Changed 4 years ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from andrew_b to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [79628270a75e335a85c0c31c9273c4fad6512492].
git log --pretty=oneline a34525c5f..79628270a
comment:12 Changed 4 years ago by psprint
Thanks. BTW, nice refactoring with GQueue.
comment:13 follow-up: ↓ 14 Changed 4 years ago by psprint
I've noticed that the order of the completion matches is reversed – i.e.: the ones that are located earlier in any buffer are displayed later in the completion listbox. (explanation, it uses the patch to list all functions in the file keeping the order). I wonder if this is done by accident, because IMO it doesn't make sense to reverse the order like that.