diff --git a/spec/text-editor-spec.js b/spec/text-editor-spec.js index 55bc68935..2f7e25f76 100644 --- a/spec/text-editor-spec.js +++ b/spec/text-editor-spec.js @@ -6613,17 +6613,6 @@ describe('TextEditor', () => { }) }) - describe('when the editor is constructed with the grammar option set', () => { - beforeEach(async () => { - await atom.packages.activatePackage('language-coffee-script') - }) - - it('sets the grammar', () => { - editor = new TextEditor({grammar: atom.grammars.grammarForScopeName('source.coffee')}) - expect(editor.getGrammar().name).toBe('CoffeeScript') - }) - }) - describe('softWrapAtPreferredLineLength', () => { it('soft wraps the editor at the preferred line length unless the editor is narrower or the editor is mini', () => { editor.update({ diff --git a/src/text-editor.js b/src/text-editor.js index f1ec52297..c179737b1 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4437,10 +4437,10 @@ class TextEditor { toggleLineCommentForBufferRow (row) { this.toggleLineCommentsForBufferRows(row, row) } toggleLineCommentsForBufferRows (start, end) { - let { - commentStartString, - commentEndString - } = this.buffer.getLanguageMode().commentStringsForPosition(Point(start, 0)) + const languageMode = this.buffer.getLanguageMode() + let {commentStartString, commentEndString} = + languageMode.commentStringsForPosition && + languageMode.commentStringsForPosition(Point(start, 0)) || {} if (!commentStartString) return commentStartString = commentStartString.trim()