Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355088 - ContentAssistProvider.getKeywords() parameters are always null.
Summary: ContentAssistProvider.getKeywords() parameters are always null.
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.3 M2   Edit
Assignee: Mark Macdonald CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 10:06 EDT by Markus Albrecht CLA
Modified: 2011-08-18 10:34 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Albrecht CLA 2011-08-18 10:06:37 EDT
Build Identifier: Version 0.3M1

When implementing an own ContentAssistProvider the getKeywords() method has to be implemented.
The method signature includes the following parameter: prefix, buffer, selection 
But they are always null.

The cause for this is, that in orion.editor.ContentAssist.getKeywords() (contentAssist.js) the parameters are not passed through.
This is the original code snippet:
                ...
		getKeywords: function(prefix, buffer, selection) {
			var keywords = [];
			
			// Add keywords from directly registered providers
			dojo.forEach(this.activeContentAssistProviders, function(provider) {
				keywords = keywords.concat(provider.getKeywords() || []); 
			});
                ...


The bug can be fixed by changing the code to:
                ...
		getKeywords: function(prefix, buffer, selection) {
			var keywords = [];
			
			// Add keywords from directly registered providers
			dojo.forEach(this.activeContentAssistProviders, function(provider) {
				keywords = keywords.concat(provider.getKeywords(prefix, buffer, selection) || []);
			});
                ...


Reproducible: Always

Steps to Reproduce:
1. Define a own ContentAssistProvider like this:
    MyContentAssistProvider.prototype =  {
        getKeywords: function(prefix, buffer, selection) {
          // prefix / buffer / selection always null
        }
    };
2. Every time the getKeywords is called the parameter are null.
Comment 1 Mark Macdonald CLA 2011-08-18 10:34:07 EDT
Thanks for the bug.

This was fixed by commit f8eab0e [1]. I tested with the latest code in HEAD and found the parameters were passed correctly to content assist providers. Any recent (after 08/16) integration build of 0.3  should have the fix.

[1] http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f8eab0e43cd36c58cae0483825ae8a57d3d16769