swift-mode icon indicating copy to clipboard operation
swift-mode copied to clipboard

mark-sexp marks more than sexp within comment blocks

Open vellvisher opened this issue 7 years ago • 1 comments

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(

vellvisher avatar Dec 19 '18 14:12 vellvisher

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

taku0 avatar Dec 23 '18 05:12 taku0