mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Do not automatically close quotes when inserted inside a string.
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user