swift-mode
swift-mode copied to clipboard
mark-sexp marks more than sexp within comment blocks
Example code with cursor as []:
// []Start my application.
public func application(
Hit C-M-SPC, C-M-@ or mark-sexp, marked region in between []
// [Start my application.
public] func application(
Expected (eg from objc-mode)
// [Start] my application.
public func application(
mark-sexp and forward/backward-sexp assume the point is not in a comment or string. We can define some reasonable behavior for such situation. forward-sexp-function is not defined for fundamental-mode nor text-mode. So we must define what is a expected behavior:
- marking a word
- marking from the point to the end of the comment/string
- marking the whole comment/string
- marking a word or balanced brackets (what if the brackets is not balanced?)
- marking a Swift token or balanced brackets