/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using Microsoft.VisualStudio.Text.Editor;
namespace dnSpy.Contracts.Text.Editor.OptionsExtensionMethods {
///
/// extension methods
///
public static class DefaultDsTextViewOptionsExtensions {
///
/// Returns true if the user can change overwrite mode
///
/// Options
///
public static bool IsCanChangeOverwriteModeEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.CanChangeOverwriteModeId);
}
///
/// Returns true if the user can enable or disable use-visible-whitespace option
///
/// Options
///
public static bool IsCanChangeUseVisibleWhitespaceEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.CanChangeUseVisibleWhitespaceId);
}
///
/// Returns true if the user can change word wrap style
///
/// Options
///
public static bool IsCanChangeWordWrapStyleEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.CanChangeWordWrapStyleId);
}
///
/// Returns true if box selection is enabled
///
/// Options
///
public static bool IsAllowBoxSelectionEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.AllowBoxSelectionId);
}
///
/// Returns true if refresh-screen-on-change is enabled
///
/// Options
///
public static bool IsRefreshScreenOnChangeEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId);
}
///
/// Returns the number of milliseconds to wait before refreshing the screen after the document gets changed
///
/// Options
///
public static int GetRefreshScreenOnChangeWaitMilliSeconds(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeWaitMilliSecondsId);
}
///
/// Returns true if text should be colorized
///
/// Options
///
public static bool IsColorizationEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.EnableColorizationId);
}
///
/// Returns true if references should be highlighted
///
/// Options
///
public static bool IsReferenceHighlightingEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.ReferenceHighlightingId);
}
///
/// Returns true if braces should be highlighted
///
/// Options
///
public static bool IsBraceMatchingEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.BraceMatchingId);
}
///
/// Returns true if line separators should be shown
///
/// Options
///
public static bool IsLineSeparatorEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.LineSeparatorsId);
}
///
/// Returns true if related keywords should be highlighted
///
/// Options
///
public static bool IsHighlightRelatedKeywordsEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.HighlightRelatedKeywordsId);
}
///
/// Returns true if empty or whitespace-only lines should be compressed
///
/// Options
///
public static bool IsCompressEmptyOrWhitespaceLinesEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.CompressEmptyOrWhitespaceLinesId);
}
///
/// Returns true if non-empty lines that don't contain letters or digits should be compressed
///
/// Options
///
public static bool IsCompressNonLetterLinesEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.CompressNonLetterLinesId);
}
///
/// Returns true if extra vertical pixels should be removed from text lines
///
/// Options
///
public static bool IsRemoveExtraTextLineVerticalPixelsEnabled(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.RemoveExtraTextLineVerticalPixelsId);
}
///
/// Gets the value
///
/// Options
///
public static BlockStructureLineKind GetBlockStructureLineKind(this IEditorOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
return options.GetOptionValue(DefaultDsTextViewOptions.BlockStructureLineKindId);
}
}
}