public static async Task <DocumentOptionSet> GetDocumentOptionsWithInferredIndentationAsync( this Document document, bool explicitFormat, IIndentationManagerService indentationManagerService, CancellationToken cancellationToken ) { var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); var snapshot = text.FindCorrespondingEditorTextSnapshot(); if (snapshot != null) { indentationManagerService.GetIndentation( snapshot.TextBuffer, explicitFormat, out var convertTabsToSpaces, out var tabSize, out var indentSize ); options = options .WithChangedOption(FormattingOptions.UseTabs, !convertTabsToSpaces) .WithChangedOption(FormattingOptions.IndentationSize, indentSize) .WithChangedOption(FormattingOptions.TabSize, tabSize); } return(options); }
public DocumentOptions( Workspace workspace, DocumentId id, IIndentationManagerService indentationManagerService ) { _workspace = workspace; _documentId = id; _indentationManagerService = indentationManagerService; }
public SplitCommentCommandHandler( ITextUndoHistoryRegistry undoHistoryRegistry, IEditorOperationsFactoryService editorOperationsFactoryService, EditorOptionsService editorOptionsService, IIndentationManagerService indentationManager, IGlobalOptionService globalOptions) { _undoHistoryRegistry = undoHistoryRegistry; _editorOperationsFactoryService = editorOperationsFactoryService; _editorOptionsService = editorOptionsService; _indentationManager = indentationManager; _globalOptions = globalOptions; }
public RawStringLiteralCommandHandler( ITextUndoHistoryRegistry undoHistoryRegistry, IGlobalOptionService globalOptions, IEditorOperationsFactoryService editorOperationsFactoryService, EditorOptionsService editorOptionsService, IIndentationManagerService indentationManager) { _undoHistoryRegistry = undoHistoryRegistry; _globalOptions = globalOptions; _editorOperationsFactoryService = editorOperationsFactoryService; _editorOptionsService = editorOptionsService; _indentationManager = indentationManager; }
public StringCopyPasteCommandHandler( IThreadingContext threadingContext, ITextUndoHistoryRegistry undoHistoryRegistry, IEditorOperationsFactoryService editorOperationsFactoryService, IGlobalOptionService globalOptions, ITextBufferFactoryService2 textBufferFactoryService, EditorOptionsService editorOptionsService, IIndentationManagerService indentationManager) { _threadingContext = threadingContext; _undoHistoryRegistry = undoHistoryRegistry; _editorOperationsFactoryService = editorOperationsFactoryService; _globalOptions = globalOptions; _textBufferFactoryService = textBufferFactoryService; _editorOptionsService = editorOptionsService; _indentationManager = indentationManager; }
public DefaultFormattingOptionsProvider( LSPDocumentManager documentManager, IIndentationManagerService indentationManagerService) { if (documentManager is null) { throw new ArgumentNullException(nameof(documentManager)); } if (indentationManagerService is null) { throw new ArgumentNullException(nameof(indentationManagerService)); } _documentManager = documentManager; _indentationManagerService = indentationManagerService; }
public EditorOptionsService(IGlobalOptionService globalOptions, IEditorOptionsFactoryService factory, IIndentationManagerService indentationManager) { GlobalOptions = globalOptions; Factory = factory; IndentationManager = indentationManager; }
private static SyntaxFormattingOptions GetSyntaxFormattingOptionsImpl(ITextBuffer textBuffer, IEditorOptions editorOptions, IIndentationManagerService indentationManager, IGlobalOptionService globalOptions, HostLanguageServices languageServices, bool explicitFormat) { var configOptions = new EditorAnalyzerConfigOptions(editorOptions); var fallbackOptions = globalOptions.GetSyntaxFormattingOptions(languageServices); var options = configOptions.GetSyntaxFormattingOptions(fallbackOptions, languageServices); var lineFormattingOptions = GetLineFormattingOptionsImpl(textBuffer, editorOptions, indentationManager, explicitFormat); return(options.With(lineFormattingOptions)); }
private static LineFormattingOptions GetLineFormattingOptionsImpl(ITextBuffer textBuffer, IEditorOptions editorOptions, IIndentationManagerService indentationManager, bool explicitFormat) { indentationManager.GetIndentation(textBuffer, explicitFormat, out var convertTabsToSpaces, out var tabSize, out var indentSize); return(new LineFormattingOptions() { UseTabs = !convertTabsToSpaces, IndentationSize = indentSize, TabSize = tabSize, NewLine = editorOptions.GetNewLineCharacter(), }); }
public InferredIndentationDocumentOptionsProviderFactory([Import(IIndentationManagerService.MefContractName, AllowDefault = true)] object indentationManagerService) { _indentationManagerService = IIndentationManagerService.FromDefaultImport(indentationManagerService); }
public CSharpFormattingInteractionService(IIndentationManagerService indentationManager, IGlobalOptionService globalOptions) { _indentationManager = indentationManager; _globalOptions = globalOptions; }
public EditorLayerInferredIndentationService(IIndentationManagerService indentationManagerService) { _indentationManagerService = indentationManagerService; }
public CSharpEditorFormattingService(IIndentationManagerService indentationManagerService) => _indentationManagerService = indentationManagerService;
public InferredIndentationDocumentOptionsProviderFactory(IIndentationManagerService indentationManagerService) { _indentationManagerService = indentationManagerService; }
public static async Task <SyntaxFormattingOptions> GetInferredFormattingOptionsAsync(this IIndentationManagerService indentationManager, Document document, SyntaxFormattingOptions fallbackOptions, bool explicitFormat, CancellationToken cancellationToken) { var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); var snapshot = text.FindCorrespondingEditorTextSnapshot(); var options = await document.GetSyntaxFormattingOptionsAsync(fallbackOptions, cancellationToken).ConfigureAwait(false); if (snapshot == null) { return(options); } indentationManager.GetIndentation(snapshot.TextBuffer, explicitFormat, out var convertTabsToSpaces, out var tabSize, out var indentSize); return(options.With(new LineFormattingOptions() { UseTabs = !convertTabsToSpaces, IndentationSize = indentSize, TabSize = tabSize, NewLine = options.NewLine })); }
public DocumentOptionsProvider(IIndentationManagerService indentationManagerService) { _indentationManagerService = indentationManagerService; }
public LegacyIndentationManagerWorkspaceService(IIndentationManagerService indentationManagerService) { _indentationManagerService = indentationManagerService; }