This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 115933 - Quickfix: Surround With for selected word wraps the word instead of line
Summary: Quickfix: Surround With for selected word wraps the word instead of line
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-19 00:08 UTC by Chris Kutler
Modified: 2007-09-20 17:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Kutler 2007-09-19 00:08:46 UTC
If I select a method and press alt+enter I get the following choices
  Surround with if condition...
  Surround with begin

When I select one of these choices, the IDE surrounds the selected method and should instead surround whole line.

For example, I have this code:

  def deleteFirst
    @songs.shift   
  end

I select "shift", press alt+enter, and choose Surround with if condition...

I get 

  def deleteFirst
    @songs.if condition
  shift
  
end   
  end

And I should get

  def deleteFirst
    if condition
    @songs.shift   
    
  end
  end

Tor wrote:

Yes. I've been meaning to make this code smarter such that when you make a selection, it goes and looks at the parse
tree and sees if each of the code snippets actually make sense before offering them. Would you mind filing an issue to
track this?
Comment 1 Torbjorn Norbye 2007-09-20 17:01:17 UTC
This is fixed now. It won't offer surround-with quickfixes for partial code fragments like this.

(It's now also better about listing code templates in code completion.)