Browse Source

fix #550: Code actions insert tabs when they should use spaces

pull/567/head
Siegfried Pammer 12 years ago
parent
commit
5f58f9ccb8
  1. 17
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs
  2. 9
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDRefactoringContext.cs

17
src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs

@ -37,14 +37,19 @@ namespace CSharpBinding
public static class ExtensionMethods public static class ExtensionMethods
{ {
public static TextEditorOptions ToEditorOptions(this ITextEditor editor) public static TextEditorOptions ToEditorOptions(this ITextEditor editor)
{
return ToEditorOptions(editor.Options);
}
public static TextEditorOptions ToEditorOptions(this ITextEditorOptions options)
{ {
return new TextEditorOptions { return new TextEditorOptions {
TabsToSpaces = editor.Options.ConvertTabsToSpaces, TabsToSpaces = options.ConvertTabsToSpaces,
TabSize = editor.Options.IndentationSize, TabSize = options.IndentationSize,
IndentSize = editor.Options.IndentationSize, IndentSize = options.IndentationSize,
ContinuationIndent = editor.Options.IndentationSize, ContinuationIndent = options.IndentationSize,
LabelIndent = -editor.Options.IndentationSize, LabelIndent = -options.IndentationSize,
WrapLineLength = editor.Options.VerticalRulerColumn, WrapLineLength = options.VerticalRulerColumn
}; };
} }

9
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SDRefactoringContext.cs

@ -44,6 +44,7 @@ namespace CSharpBinding.Refactoring
readonly ITextEditor editor; readonly ITextEditor editor;
readonly ITextSource textSource; readonly ITextSource textSource;
readonly TextLocation location; readonly TextLocation location;
readonly TextEditorOptions editorOptions;
IDocument document; IDocument document;
int selectionStart, selectionLength; int selectionStart, selectionLength;
@ -86,6 +87,7 @@ namespace CSharpBinding.Refactoring
this.selectionStart = selectionStart; this.selectionStart = selectionStart;
this.selectionLength = selectionLength; this.selectionLength = selectionLength;
this.location = location; this.location = location;
this.editorOptions = SD.EditorControlService.GlobalOptions.ToEditorOptions();
InitializeServices(); InitializeServices();
} }
@ -99,6 +101,7 @@ namespace CSharpBinding.Refactoring
this.selectionStart = editor.SelectionStart; this.selectionStart = editor.SelectionStart;
this.selectionLength = editor.SelectionLength; this.selectionLength = editor.SelectionLength;
this.location = location; this.location = location;
this.editorOptions = editor.ToEditorOptions();
InitializeServices(); InitializeServices();
} }
@ -131,6 +134,12 @@ namespace CSharpBinding.Refactoring
} }
} }
public override TextEditorOptions TextEditorOptions {
get {
return editorOptions;
}
}
public IDocument Document { public IDocument Document {
get { get {
IDocument result = LazyInit.VolatileRead(ref document); IDocument result = LazyInit.VolatileRead(ref document);

Loading…
Cancel
Save