Second attempt: don't blow up when commenting in files w/ no language bundle

This commit is contained in:
Nathan Sobo
2012-09-25 17:14:25 -06:00
parent 685cbc3575
commit 1383a94d60
2 changed files with 3 additions and 2 deletions

View File

@@ -1349,7 +1349,8 @@ describe "EditSession", ->
expect(editSession.getSelection().isEmpty()).toBeTruthy()
it "does not explode if the current language mode has no comment regex", ->
spyOn(TextMateBundle, 'lineCommentStringForScope').andReturn(null)
editSession.destroy()
editSession = fixturesProject.buildEditSessionForPath(null, autoIndent: false)
editSession.setSelectedBufferRange([[4, 5], [4, 5]])
editSession.toggleLineCommentsInSelection()
expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {"

View File

@@ -36,7 +36,7 @@ class TextMateBundle
@lineCommentStringForScope: (scope) ->
shellVariables = @getPreferenceInScope(scope, 'shellVariables')
lineComment = (_.find shellVariables, ({name}) -> name == "TM_COMMENT_START")['value']
(_.find shellVariables, ({name}) -> name == "TM_COMMENT_START")?['value']
@indentRegexForScope: (scope) ->
if source = @getPreferenceInScope(scope, 'increaseIndentPattern')