[all-commits] [llvm/llvm-project] 243f52: [lldb] Cut off unused suffix in CompletionRequest:...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Jan 28 02:12:47 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 243f52b58bcefab68fdebefc6d64f7f0c182c0fe
      https://github.com/llvm/llvm-project/commit/243f52b58bcefab68fdebefc6d64f7f0c182c0fe
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-01-28 (Tue, 28 Jan 2020)

  Changed paths:
    M lldb/include/lldb/Utility/CompletionRequest.h
    M lldb/source/Commands/CommandObjectExpression.cpp
    M lldb/unittests/Utility/CompletionRequestTest.cpp

  Log Message:
  -----------
  [lldb] Cut off unused suffix in CompletionRequest::GetRawLine

The GetRawLine currently returns the full command line used
to create the CompletionRequest. So for example for "foo b[tab] --arg"
it would return the whole string instead of "foo b". Usually
completion code makes the wrong assumption that the cursor is at
the end of the line and handing out the complete line will cause
that people implement completions that also make this assumption.

This patch makes GetRawLine() return only the string until the
cursor and hides the suffix (so that the cursor is always at the
end of this string) and adds another function GetRawLineWithUnusedSuffix
that is specifically the line with the suffix that isn't used by
the CompletionRequest for argument parsing etc.

There is only one user of this new function that actually needs the
suffix and that is the expression command which needs the suffix to
detect if it is in the raw or argument part of the command (by looking
at the "--" separator).




More information about the All-commits mailing list