Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apex language auto suggest not working #1202

Closed
ruchikam opened this issue Nov 19, 2018 · 3 comments
Closed

Apex language auto suggest not working #1202

ruchikam opened this issue Nov 19, 2018 · 3 comments
Assignees
Labels

Comments

@ruchikam
Copy link

ruchikam commented Nov 19, 2018

My code is:

function createDependencyProposalsApex() {
  // returning a static list of proposals, not even looking at the prefix (filtering is done by the Monaco editor),
  // here you could do a server side lookup
  var classes = allClasses;
  var pages = allPages;
  if(typeof classes == "string"){
      classes = JSON.parse( classes );
  }
  if(typeof pages == "string"){
      pages = JSON.parse( pages );
  }
  /*chrome.storage.local.get('AllClasses', function (result) {
         classes= JSON.parse(result.AllClasses);
         chrome.storage.local.get('AllPages', function (result) {
	         pages= JSON.parse(result.AllPages);
	*/
  suggestions = [];
  for (var i = 0; i < classes.length; i++) {
    var classObj = {
      label: classes[i].Name,
      kind: monaco.languages.CompletionItemKind.Function,
      insertText: classes[i].Name
    }
    suggestions.push(classObj);
  }
  for (var i = 0; i < pages.length; i++) {
    var pageObj = {
      label: pages[i].Name,
      kind: monaco.languages.CompletionItemKind.Function,
      insertText: pages[i].Name
    }
    suggestions.push(pageObj);
  }
  return suggestions;

}

monaco.languages.registerCompletionItemProvider('apex', {
      provideCompletionItems: function(model, position) {
        var suggestions = createDependencyProposalsApex();
        return suggestions;
      }
    });

It id showning only the class text as suggestion

@alexdima
Copy link
Member

This is a breaking API change in 0.15.x, documented in the release notes:
image

The sample here has also been updated.

	export interface CompletionList {
		suggestions: CompletionItem[];
		incomplete?: boolean;
		dispose?(): void;
	}

	/**
	 * The completion item provider interface defines the contract between extensions and
	 * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).
	 *
	 * When computing *complete* completion items is expensive, providers can optionally implement
	 * the `resolveCompletionItem`-function. In that case it is enough to return completion
	 * items with a [label](#CompletionItem.label) from the
	 * [provideCompletionItems](#CompletionItemProvider.provideCompletionItems)-function. Subsequently,
	 * when a completion item is shown in the UI and gains focus this provider is asked to resolve
	 * the item, like adding [doc-comment](#CompletionItem.documentation) or [details](#CompletionItem.detail).
	 */
	export interface CompletionItemProvider {
		triggerCharacters?: string[];
		/**
		 * Provide completion items for the given position and document.
		 */
		provideCompletionItems(model: editor.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionList>;
		/**
		 * Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
		 * or [details](#CompletionItem.detail).
		 *
		 * The editor will only resolve a completion item once.
		 */
		resolveCompletionItem?(model: editor.ITextModel, position: Position, item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
	}

@ruchikam
Copy link
Author

It is showing only custom suggestion .How to get default suggestion along with custom suggestion.

@jrieken
Copy link
Member

jrieken commented Nov 21, 2018

It is showing only custom suggestion .How to get default suggestion along with custom suggestion.

Default suggestion only show when no other suggestions have been computed.

@jrieken jrieken closed this as completed Nov 21, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants