mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Second attempt: don't blow up when commenting in files w/ no language bundle
This commit is contained in:
@@ -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) {"
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user