How do you do the Refactor move into class operation?


(mtiede) #1

I marked a methods “begin” to “end” section and tried the refactor and it blew up and gave me:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at RemObjects.Elements.RTL.List`1.get_Item__$mapped__(List`1 self, Int32 i)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.rangeOfIdentifierAtCursorX____y(Int32 x, Int32 y)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.makeSoftSelectionAtCursorX____y__expandBeyond(Int32 x, Int32 y, Boolean expandBeyond)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.makeSoftSelectionForPopup(Boolean expandBeyond)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.initiatePopupWithMessage____withSoftSelection(String message, Boolean withSoftSelection)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.initiatePopupWithMessage(String message)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.refactorCallback______action(FCERefactoringResults results, FCECodeEditorSmartsFeedback feedback, Action`1 action)
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.<refactorOxygeneConvertToUnified>b__0(FCERefactoringResults results, FCECodeEditorSmartsFeedback feedback)
at RemObjects.Fire.ProjectSystem.TextFile.<>c__DisplayClass83.<refactorFixIts>b__4()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

I was able to take method code in the type declaration and split it out to interface and implementation sections, but I don’t understand the process to “unsplit” them.

… time passes …

I tried again by including the method line and it worked. I thought I tried that same thing yesterday and it did nothing. But maybe that was a different version than the beta I’m running now. (2305) Still, it did blow up when I told it the wrong thing to do.


(marc hoffman) #2

A full testcase Wirth the exact selection you make to cause this would be appreciated.


(mtiede) #3

Here was the code from the template and separated into interface and implementation:

namespace MyModule;

interface

type
  [Export]
  Program = public class
  private
  public

    method HelloWorld;

  end;


implementation

method Program.HelloWorld;
begin
      writeLn('HelloWorld');
      var el := WebAssembly.GetElementById('helloWorld');
      if el = nil then begin
         writeLn('Element by ID test is null!');
         exit;
         end;
      var t2 := WebAssembly.CreateTextNode('Hello from Elements WebAssembly!');
      el.appendChild(t2);
      end;
end.

And the block below was what I marked before using the menu option to put it back into the method without the interface and implementation.

begin
      writeLn('HelloWorld');
      var el := WebAssembly.GetElementById('helloWorld');
      if el = nil then begin
         writeLn('Element by ID test is null!');
         exit;
         end;
      var t2 := WebAssembly.CreateTextNode('Hello from Elements WebAssembly!');
      el.appendChild(t2);
      end;

(RemObjects) #4

Thanks, logged as bugs://80578


(RemObjects) #5

bugs://80578 got closed with status fixed.