Do not automatically close quotes when inserted inside a string.

This commit is contained in:
Corey Johnson
2012-10-29 11:40:15 -07:00
parent f7f64ea9f3
commit 82e0a458fa
3 changed files with 19 additions and 1 deletions

View File

@@ -23,7 +23,10 @@ class LanguageMode
cursorBufferPosition = @editSession.getCursorBufferPosition()
nextCharachter = @editSession.getTextInBufferRange([cursorBufferPosition, cursorBufferPosition.add([0,1])])
autoCompleteOpeningBracket = @isOpeningBracket(text) and /\W|^$/.test(nextCharachter)
hasWordAfterCursor = /\w/.test(nextCharachter)
cursorInsideString = @tokenizedBuffer.isBufferPositionInsideString(cursorBufferPosition)
autoCompleteOpeningBracket = @isOpeningBracket(text) and not hasWordAfterCursor and not cursorInsideString
skipOverExistingClosingBracket = false
if @isClosingBracket(text) and nextCharachter == text
if bracketAnchorRange = @bracketAnchorRanges.filter((anchorRange) -> anchorRange.getBufferRange().end.isEqual(cursorBufferPosition))[0]

View File

@@ -117,6 +117,10 @@ class TokenizedBuffer
iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken)
return unless keepLooping
isBufferPositionInsideString: (bufferPosition) ->
if lastScope = _.last(@scopesForPosition(bufferPosition))
/^string\./.test(lastScope)
findOpeningBracket: (startBufferPosition) ->
range = [[0,0], startBufferPosition]
position = null