Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 518623

Summary: [lsp] Content assist assumes ServerCapabilities.CompletionOptions.triggerCharacters is defined
Product: [ECD] Orion Reporter: Remy Suen <remy.suen>
Component: ClientAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: unspecified   
Target Milestone: 15.0   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2017-06-22 05:47:43 EDT
7b70330e201f86ba33a586c4c6e9f7871a9e8308

1. Connect Orion to a language server that doesn't support trigger characters for code completion.
2. Open the file and try to edit it.
3. Errors will be logged.

/**
 * Completion options.
 */
export interface CompletionOptions {
	/**
	 * The server provides support to resolve additional
	 * information for a completion item.
	 */
	resolveProvider?: boolean;

	/**
	 * The characters that trigger completion automatically.
	 */
	triggerCharacters?: string[];
}

According to the spec, triggerCharacters is an optional attribute so we shouldn't try to arbitrarily read it without first checking that it exists.

contentAssist.js:750 Uncaught TypeError: Cannot read property 'forEach' of undefined
    at ContentAssist.<anonymous> (http://localhost:8081/orion/editor/contentAssist.js:750:43)
    at Array.forEach (native)
    at ContentAssist._triggerListener (http://localhost:8081/orion/editor/contentAssist.js:737:21)
    at TextView._dispatchEvent (http://localhost:8081/orion/editor/eventTarget.js:82:12)
    at TextView.dispatchEvent (http://localhost:8081/orion/editor/eventTarget.js:62:9)
    at TextView.onModify (http://localhost:8081/orion/editor/textView.js:2759:16)
    at TextView._modifyContent (http://localhost:8081/orion/editor/textView.js:6632:9)
    at TextView._doContent (http://localhost:8081/orion/editor/textView.js:4917:16)
    at TextView._handleKeyPress (http://localhost:8081/orion/editor/textView.js:3924:11)
    at HTMLDivElement.handler (http://localhost:8081/orion/editor/textView.js:6375:91)
Comment 1 Remy Suen CLA 2017-06-22 05:56:04 EDT
Fix pushed to the java-lsp branch.

https://github.com/eclipse/orion.client/commit/40cd394f1df05da74ed31b46833f82777f6805d9