{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/127","repository_url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node","labels_url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/127/comments","events_url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/127/events","html_url":"https://github.com/Microsoft/vscode-languageserver-node/issues/127","id":190455715,"number":127,"title":"Cannot read property 'range' of null: CompletionItem.textEdit cannot be null","user":{"login":"felixfbecker","id":10532611,"avatar_url":"https://avatars.githubusercontent.com/u/10532611?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfbecker","html_url":"https://github.com/felixfbecker","followers_url":"https://api.github.com/users/felixfbecker/followers","following_url":"https://api.github.com/users/felixfbecker/following{/other_user}","gists_url":"https://api.github.com/users/felixfbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfbecker/subscriptions","organizations_url":"https://api.github.com/users/felixfbecker/orgs","repos_url":"https://api.github.com/users/felixfbecker/repos","events_url":"https://api.github.com/users/felixfbecker/events{/privacy}","received_events_url":"https://api.github.com/users/felixfbecker/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-11-19T00:51:52Z","updated_at":"2016-12-16T16:09:40Z","closed_at":"2016-12-16T15:31:49Z","body":"The protocol defines that all properties on `CompletionItem` except `label` are optional. However, sending a completion item with only a `label` results in this exception:\r\n```\r\nCannot read property 'range' of null: TypeError: Cannot read property 'range' of null\r\n    at asTextEdit (C:\\Users\\felix\\git\\OpenSource\\vscode-php-intellisense\\node_modules\\vscode-languageclient\\lib\\protocolConverter.js:108:46)\r\n    at C:\\Users\\felix\\git\\OpenSource\\vscode-php-intellisense\\node_modules\\vscode-languageclient\\lib\\protocolConverter.js:101:67\r\n    at set (C:\\Users\\felix\\git\\OpenSource\\vscode-php-intellisense\\node_modules\\vscode-languageclient\\lib\\protocolConverter.js:89:13)\r\n    at asCompletionItem (C:\\Users\\felix\\git\\OpenSource\\vscode-php-intellisense\\node_modules\\vscode-languageclient\\lib\\protocolConverter.js:101:9)\r\n    at Array.map (native)\r\n    at asCompletionResult (C:\\Users\\felix\\git\\OpenSource\\vscode-php-intellisense\\node_modules\\vscode-languageclient\\lib\\protocolConverter.js:82:26)\r\n    at process._tickCallback (internal/process/next_tick.js:103:7)\r\n```\r\nThat is because [here](https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/protocolConverter.ts#L182) `textEdit` is passed to `asTextEdit`, which passes `textEdit.range` to `asRange`. `textEdit` can be `null` though, which leads to the exception.\r\n\r\nThe same happens with `asCommand`.\r\n\r\nI highly recommend you to take a look at `strictNullChecks` - it prevents these bugs at compile-time!"},"comment":{"url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/comments/267628848","html_url":"https://github.com/Microsoft/vscode-languageserver-node/issues/127#issuecomment-267628848","issue_url":"https://api.github.com/repos/Microsoft/vscode-languageserver-node/issues/127","id":267628848,"user":{"login":"felixfbecker","id":10532611,"avatar_url":"https://avatars.githubusercontent.com/u/10532611?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfbecker","html_url":"https://github.com/felixfbecker","followers_url":"https://api.github.com/users/felixfbecker/followers","following_url":"https://api.github.com/users/felixfbecker/following{/other_user}","gists_url":"https://api.github.com/users/felixfbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfbecker/subscriptions","organizations_url":"https://api.github.com/users/felixfbecker/orgs","repos_url":"https://api.github.com/users/felixfbecker/repos","events_url":"https://api.github.com/users/felixfbecker/events{/privacy}","received_events_url":"https://api.github.com/users/felixfbecker/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T16:09:40Z","updated_at":"2016-12-16T16:09:40Z","body":"Isn't `insertString` + `range` exactly the same as `textEdit`?\r\nAlso, the LSP docs state that if `insertText` is not set, `label` is used in its place"}}
{"actor":{"display_login":"felixfbecker"}}