public static void Update(IWpfTextView view, FileSettings settings)
        {
            if (settings.InsertFinalNewLine.HasValue
                && settings.InsertFinalNewLine.Value)
            {
                EnsureTrailingNewLine(view);
            }

            if (settings.TrimTrailingWhitespace.HasValue
                && settings.TrimTrailingWhitespace.Value)
            {
                TrimTrailingWhitespace(view);
            }
        }
        public static void Update(IWpfTextView view, FileSettings settings)
        {
            if (settings.InsertFinalNewLine.HasValue &&
                settings.InsertFinalNewLine.Value)
            {
                EnsureTrailingNewLine(view);
            }

            if (settings.TrimTrailingWhitespace.HasValue &&
                settings.TrimTrailingWhitespace.Value)
            {
                TrimTrailingWhitespace(view);
            }

            if (settings.EndOfLine != null)
            {
                EnsureEndOfLine(view, settings.EndOfLine);
            }
        }
示例#3
0
 public ViewsSettings(IWpfTextView view, FileSettings settings)
 {
     Settings = settings;
     Views    = new HashSet <IWpfTextView>();
     Views.Add(view);
 }
示例#4
0
 public void Update(string oldFilepath, string newFilePath, IWpfTextView view, FileSettings newSettings)
 {
     Unregister(oldFilepath, view);
     Register(newFilePath, view, newSettings);
 }
示例#5
0
        /// <summary>
        /// Loads the settings for the given file path
        /// </summary>
        private void LoadSettings(string path)
        {
            ClearMessage();
            settings = null;

            // Prevent parsing of internet-located documents,
            // or documents that do not have proper paths.
            if (path.StartsWith("http:", StringComparison.OrdinalIgnoreCase)
                || path.Equals("Temp.txt"))
                return;

            try
            {
                settings = new FileSettings(Core.Parse(path));
                ApplyLocalSettings();
            }
            catch (ParseException e)
            {
                ShowError(path, "EditorConfig syntax error in file \"" + e.File + "\", line " + e.Line);
            }
            catch (CoreException e)
            {
                ShowError(path, "EditorConfig core error: " + e.Message);
            }
        }
        public void Register(string filepath, IWpfTextView view, FileSettings settings)
        {
            ViewsSettings viewsSettings;

            if (!views.TryGetValue(filepath, out viewsSettings))
            {
                viewsSettings = new ViewsSettings(view, settings);
                views.Add(filepath, viewsSettings);
            }
            else
            {
                Debug.Assert(!viewsSettings.Views.Contains(view));

                viewsSettings.Views.Add(view);
            }
        }
 public ViewsSettings(IWpfTextView view, FileSettings settings)
 {
     Settings = settings;
     Views = new HashSet<IWpfTextView>();
     Views.Add(view);
 }
 public void Update(string oldFilepath, string newFilePath, IWpfTextView view, FileSettings newSettings)
 {
     Unregister(oldFilepath, view);
     Register(newFilePath, view, newSettings);
 }