Ticket #4160 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

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

0001-Add-an-option-to-complete-words-from-all-open-files-.patch (3.4 KB) - added by psprint 3 years ago.
CompleteAllFiles_v2-1.patch (6.6 KB) - added by psprint 3 years ago.
complete from all open buffers by default
EntireFileCompletionDefault.patch (2.5 KB) - added by psprint 3 years ago.
AllFilesCompletion_v3.patch (6.2 KB) - added by psprint 3 years ago.
no change of other options
AllFilesComplete_v3.1_with_man.patch (6.9 KB) - added by psprint 3 years ago.
includes manpage documentation on the new option

Change History

comment:1 Changed 3 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:2 Changed 3 years ago by psprint

Ok, but what's wrong with the style in the patch?

comment:4 Changed 3 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 3 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.

Last edited 3 years ago by psprint (previous) (diff)

Changed 3 years ago by psprint

complete from all open buffers by default

comment:6 in reply to: ↑ 5 Changed 3 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).

Last edited 3 years ago by andrew_b (previous) (diff)

comment:7 Changed 3 years ago by psprint

Here's a patch that makes the editor_wordcompletion_entire_file option enabled by default.

Version 0, edited 3 years ago by psprint (next)

Changed 3 years ago by psprint

Changed 3 years ago by psprint

no change of other options

Changed 3 years ago by psprint

includes manpage documentation on the new option

comment:8 Changed 3 years ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • 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 3 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:10 Changed 3 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:11 Changed 3 years ago by andrew_b

  • Status changed from testing to closed

comment:12 Changed 3 years ago by psprint

Thanks. BTW, nice refactoring with GQueue.

comment:13 follow-up: ↓ 14 Changed 3 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.

Last edited 3 years ago by psprint (previous) (diff)

comment:14 in reply to: ↑ 13 Changed 3 years ago by andrew_b

Replying to psprint:

I've noticed that the order of the completion matches is reversed

That was done in #1486. I tried to keep that solution for current file. Order of completions from other files is unimportant.

Note: See TracTickets for help on using tickets.