This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 375472 - Content assist API cleanup
Summary: Content assist API cleanup
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Client (show other bugs)
Version: 0.5   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 0.5 M1   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-27 15:38 EDT by Mark Macdonald CLA
Modified: 2012-03-27 18:11 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2012-03-27 15:38:45 EDT
This is a spin-off from bug 372364. The content assist API should be updated to reorganize the parameters and to make providers less dependent on the 'prefix' parameter.

The proposed API signature is:
 computeProposals: function(buffer, offset, context)

The 'context' param is an Object with this shape:
  { line  // String. Entire line that content assist was invoked on.
    prefix // String. Prefix hint.
    selection // Object. Current editor selection.
  }

The "proposal objects" returned by a content assist provider will also change. Their new shape is
{ proposal // String. Text to insert at the offset. (required)
  description // String. Text to display in content assist panel. (required)
  escapePosition // Number. Caret position after accepting proposal. (optional)
  positions // Array. For entering linked mode. (optional)
}

Note the 'proposal' semantics have changed: the prefix is no longer chopped off a proposal when it's inserted by the content assist engine. Any provider that relied on the old behavior must now remove the prefix manually from its proposals.

Current API docs, for reference:
[1] http://wiki.eclipse.org/index.php?title=Orion/Documentation/Developer_Guide/Plugging_into_the_editor&oldid=295279#Service_methods_2
Comment 1 Mark Macdonald CLA 2012-03-27 18:11:10 EDT
Pushed to master:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=da91e646a6521e3fea7dc0a02d0484ee63e073b8

While fixing this I found a bug in the CSS content assist provider. It incorrectly uses the prefix given by the content assist engine, which stops at a hyphen character. The upshot is that if you type 'font-' and invoke content assist, you don't see the expected proposals. This is fixed.