Skip to content

Commit

Permalink
code style issues fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Oct 25, 2019
1 parent a86cb2a commit 5e72b1a
Show file tree
Hide file tree
Showing 77 changed files with 2,278 additions and 1,890 deletions.
31 changes: 16 additions & 15 deletions VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocMouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace AsmDude.AsmDoc
{
using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
Expand Down Expand Up @@ -57,7 +58,7 @@ public AsmDocMouseHandler(
CtrlKeyState state,
AsmDudeTools asmDudeTools)
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:constructor: file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(view.TextBuffer)));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:constructor: file={1}", this.ToString(), AsmDudeToolsStatic.GetFilename(view.TextBuffer)));
this._view = view ?? throw new ArgumentNullException(nameof(view));
this._state = state ?? throw new ArgumentNullException(nameof(state));
this._aggregator2 = AsmDudeToolsStatic.GetOrCreate_Aggregator(view.TextBuffer, aggregatorFactory);
Expand All @@ -81,12 +82,12 @@ public AsmDocMouseHandler(
// Some other points to clear the highlight span:
this._view.LostAggregateFocus += (sender, args) =>
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:event: LostAggregateFocus", this.ToString()));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: LostAggregateFocus", this.ToString()));
this.Set_Highlight_Span(null);
};
this._view.VisualElement.MouseLeave += (sender, args) =>
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:event: MouseLeave", this.ToString()));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: MouseLeave", this.ToString()));
this.Set_Highlight_Span(null);
};
}
Expand Down Expand Up @@ -132,7 +133,7 @@ private bool InDragOperation(Point anchorPoint, Point currentPoint)

public override void PreprocessMouseLeave(MouseEventArgs e)
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:event: PreprocessMouseLeave; position={1}", this.ToString(), e));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: PreprocessMouseLeave; position={1}", this.ToString(), e));
this._mouseDownAnchorPoint = null;
}

Expand Down Expand Up @@ -167,7 +168,7 @@ public override void PreprocessMouseUp(MouseButtonEventArgs e)
}
catch (Exception ex)
{
AsmDudeToolsStatic.Output_ERROR(string.Format("{0} PreprocessMouseUp; e={1}", this.ToString(), ex.ToString()));
AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0} PreprocessMouseUp; e={1}", this.ToString(), ex.ToString()));
}
}
}
Expand All @@ -183,7 +184,7 @@ private Point RelativeToView(Point position)

private bool TryHighlightItemUnderMouse(Point position)
{
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:event: TryHighlightItemUnderMouse; position={1}", this.ToString(), position));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:event: TryHighlightItemUnderMouse; position={1}", this.ToString(), position));
if (!Settings.Default.AsmDoc_On)
{
return false;
Expand Down Expand Up @@ -272,7 +273,7 @@ private bool Set_Highlight_Span(SnapshotSpan? span)

private async Task<bool> Dispatch_Goto_DocAsync(Mnemonic mnemonic)
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:DispatchGoToDoc; keyword=\"{1}\".", this.ToString(), keyword));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:DispatchGoToDoc; keyword=\"{1}\".", this.ToString(), keyword));
int hr = await this.Open_File_Async(mnemonic).ConfigureAwait(false); // use .ConfigureAwait(false) to signal your intention for continuation.
return ErrorHandler.Succeeded(hr);
}
Expand Down Expand Up @@ -306,7 +307,7 @@ private string Get_Url(Mnemonic mnemonic)
while (enumerator.MoveNext())
{
EnvDTE.Window window = enumerator.Current as EnvDTE.Window;
if (window.ObjectKind.Equals(EnvDTE.Constants.vsWindowKindWebBrowser))
if (string.Equals(window.ObjectKind, EnvDTE.Constants.vsWindowKindWebBrowser, StringComparison.Ordinal))
{
string url2 = VisualStudioWebBrowser.GetWebBrowserWindowUrl(window).ToString();
//AsmDudeToolsStatic.Output_INFO("Documentation " + window.Caption + " is open. url=" + url2.ToString());
Expand All @@ -329,15 +330,15 @@ private async Task<int> Open_File_Async(Mnemonic mnemonic)
string url = this.Get_Url(mnemonic);
if (url == null)
{ // this situation happens for all keywords that do not have an url specified (such as registers).
//AsmDudeToolsStatic.Output_INFO(string.Format("INFO: {0}:openFile; url for keyword \"{1}\" is null.", this.ToString(), keyword));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "INFO: {0}:openFile; url for keyword \"{1}\" is null.", this.ToString(), keyword));
return 1;
}
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:Open_File; url={1}", this.ToString(), url));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Open_File; url={1}", this.ToString(), url));

DTE2 dte2 = Package.GetGlobalService(typeof(SDTE)) as DTE2;
if (dte2 == null)
{
AsmDudeToolsStatic.Output_WARNING(string.Format("{0}:Open_File; dte2 is null.", this.ToString()));
AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Open_File; dte2 is null.", this.ToString()));
return 1;
}

Expand All @@ -348,7 +349,7 @@ private async Task<int> Open_File_Async(Mnemonic mnemonic)
{
// vsNavigateOptionsDefault 0 The Web page opens in the currently open browser window. (Default)
// vsNavigateOptionsNewWindow 1 The Web page opens in a new browser window.
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:Open_File; going to open url {1}.", this.ToString(), url));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Open_File; going to open url {1}.", this.ToString(), url));
window = dte2.ItemOperations.Navigate(url, EnvDTE.vsNavigateOptions.vsNavigateOptionsNewWindow);

string[] parts = url.Split('/');
Expand All @@ -362,14 +363,14 @@ private async Task<int> Open_File_Async(Mnemonic mnemonic)
try
{
ThreadHelper.ThrowIfNotOnUIThread();
if (!window.Caption.Equals(caption))
if (!window.Caption.Equals(caption, StringComparison.Ordinal))
{
window.Caption = caption;
}
}
catch (Exception e)
{
AsmDudeToolsStatic.Output_ERROR(string.Format("{0}:Open_File; exception={1}", this.ToString(), e));
AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Open_File; exception={1}", this.ToString(), e));
}
});
DelayAction(100, action);
Expand All @@ -386,7 +387,7 @@ private async Task<int> Open_File_Async(Mnemonic mnemonic)
}
catch (Exception e)
{
AsmDudeToolsStatic.Output_ERROR(string.Format("{0}:Open_File; exception={1}", this.ToString(), e));
AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Open_File; exception={1}", this.ToString(), e));
return 2;
}
}
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/asm-dude-vsix/AsmDudePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void changeFontAutoComplete() {
EnvDTE.Properties asmDudePropertiesList = vsEnvironment.get_Properties("AsmDude", "Asm Documentation");
if (asmDudePropertiesList != null) {
string url = asmDudePropertiesList.Item("_asmDocUrl").Value as string;
AsmDudeToolsStatic.Output_INFO(string.Format("{0}:changeFontAutoComplete. url=", this.ToString(), url));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:changeFontAutoComplete. url=", this.ToString(), url));
}
}
if (false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal BraceMatchingTagger(ITextView view, ITextBuffer buffer)
}
else
{
AsmDudeToolsStatic.Output_WARNING(string.Format("{0}:BraceMatchingTagger; file {1} contains {2} lines which is more than maxLines {3}; switching off brace matching", this.ToString(), AsmDudeToolsStatic.GetFilename(buffer), buffer.CurrentSnapshot.LineCount, AsmDudeToolsStatic.MaxFileLines));
AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:BraceMatchingTagger; file {1} contains {2} lines which is more than maxLines {3}; switching off brace matching", this.ToString(), AsmDudeToolsStatic.GetFilename(buffer), buffer.CurrentSnapshot.LineCount, AsmDudeToolsStatic.MaxFileLines));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public CodeCompletionCommandFilter(IWpfTextView textView, ICompletionBroker brok
this._currentSession = null;
this.TextView = textView ?? throw new ArgumentNullException(nameof(textView));
this.Broker = broker ?? throw new ArgumentNullException(nameof(broker));
//Debug.WriteLine(string.Format("INFO: {0}:constructor", this.ToString()));
//Debug.WriteLine(string.Format(AsmDudeToolsStatic.CultureUI, "INFO: {0}:constructor", this.ToString()));
}

public IWpfTextView TextView { get; private set; }
Expand Down Expand Up @@ -154,7 +154,7 @@ private int ExecMethod2(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, I
{
ThreadHelper.ThrowIfNotOnUIThread();

//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:ExecMethod2", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:ExecMethod2", this.ToString()));

bool handledChar = false;
int hresult = VSConstants.S_OK;
Expand Down Expand Up @@ -259,17 +259,17 @@ private bool StartSession()

if (this.Broker.IsCompletionActive(this.TextView))
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:StartSession. Recycling an existing auto-complete session", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:StartSession. Recycling an existing auto-complete session", this.ToString()));
this._currentSession = this.Broker.GetSessions(this.TextView)[0];
}
else
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:StartSession. Creating a new auto-complete session", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:StartSession. Creating a new auto-complete session", this.ToString()));
this._currentSession = this.Broker.CreateCompletionSession(this.TextView, snapshot.CreateTrackingPoint(caret, PointTrackingMode.Positive), true);
}
this._currentSession.Dismissed += (sender, args) => this._currentSession = null;
this._currentSession.Start();
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:StartSession", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:StartSession", this.ToString()));
return true;
}

Expand Down Expand Up @@ -323,14 +323,14 @@ private void Filter()
public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
{
ThreadHelper.ThrowIfNotOnUIThread();
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:QueryStatus", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:QueryStatus", this.ToString()));
if (pguidCmdGroup == VSConstants.VSStd2K)
{
switch ((VSConstants.VSStd2KCmdID)prgCmds[0].cmdID)
{
case VSConstants.VSStd2KCmdID.AUTOCOMPLETE:
case VSConstants.VSStd2KCmdID.COMPLETEWORD:
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:QueryStatus", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:QueryStatus", this.ToString()));
//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO: {0}:QueryStatus", this.ToString()));
prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_ENABLED | (uint)OLECMDF.OLECMDF_SUPPORTED;
return VSConstants.S_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public int Compare(Completion x, Completion y)
{
Contract.Requires(x != null);
Contract.Requires(y != null);
return x.InsertionText.CompareTo(y.InsertionText);
return string.CompareOrdinal(x.InsertionText, y.InsertionText);
}
}

Expand Down Expand Up @@ -72,7 +72,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio

try
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:AugmentCompletionSession", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:AugmentCompletionSession", this.ToString()));

if (!Settings.Default.CodeCompletion_On)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
Mnemonic mnemonic = t.mnemonic;
string previousKeyword = AsmDudeToolsStatic.Get_Previous_Keyword(line.Start, start).ToUpper(CultureInfo.InvariantCulture);

//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:AugmentCompletionSession. lineStr=\"{1}\"; previousKeyword=\"{2}\"", this.ToString(), lineStr, previousKeyword));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:AugmentCompletionSession. lineStr=\"{1}\"; previousKeyword=\"{2}\"", this.ToString(), lineStr, previousKeyword));

if (mnemonic == Mnemonic.NONE)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
}
catch (Exception e)
{
AsmDudeToolsStatic.Output_ERROR(string.Format("{0}:AugmentCompletionSession; e={1}", this.ToString(), e.ToString()));
AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:AugmentCompletionSession; e={1}", this.ToString(), e.ToString()));
}
}

Expand Down
10 changes: 5 additions & 5 deletions VS/CSHARP/asm-dude-vsix/CodeFolding/CodeFoldingTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ public CodeFoldingTagger(
ITagAggregator<AsmTokenTag> aggregator,
ErrorListProvider errorListProvider)
{
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:constructor", this.ToString()));
//AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:constructor", this.ToString()));
this._buffer = buffer ?? throw new ArgumentNullException(nameof(buffer));
this._aggregator = aggregator ?? throw new ArgumentNullException(nameof(aggregator));
this._errorListProvider = errorListProvider ?? throw new ArgumentNullException(nameof(errorListProvider));

this._snapshot = buffer.CurrentSnapshot;
this._regions = new List<Region>();

AsmDudeToolsStatic.Output_INFO(string.Format("{0}:constructor; number of lines in file = {1}", this.ToString(), buffer.CurrentSnapshot.LineCount));
AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:constructor; number of lines in file = {1}", this.ToString(), buffer.CurrentSnapshot.LineCount));

this._enabled = true;

if (buffer.CurrentSnapshot.LineCount >= AsmDudeToolsStatic.MaxFileLines)
{
this._enabled = false;
AsmDudeToolsStatic.Output_WARNING(string.Format("{0}:CodeFoldingTagger; file {1} contains {2} lines which is more than maxLines {3}; switching off code folding", this.ToString(), AsmDudeToolsStatic.GetFilename(buffer), buffer.CurrentSnapshot.LineCount, AsmDudeToolsStatic.MaxFileLines));
AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:CodeFoldingTagger; file {1} contains {2} lines which is more than maxLines {3}; switching off code folding", this.ToString(), AsmDudeToolsStatic.GetFilename(buffer), buffer.CurrentSnapshot.LineCount, AsmDudeToolsStatic.MaxFileLines));
}

if (this._enabled)
Expand Down Expand Up @@ -304,7 +304,7 @@ private TextBlock Get_Hover_Text_TextBlock(int beginLineNumber, int endLineNumbe
}
catch (Exception e)
{
AsmDudeToolsStatic.Output_ERROR(string.Format("{0}:Is_Start_Masm_Keyword; e={1}", this.ToString(), e.ToString()));
AsmDudeToolsStatic.Output_ERROR(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:Is_Start_Masm_Keyword; e={1}", this.ToString(), e.ToString()));
}
return (-1, -1);
}
Expand Down Expand Up @@ -648,7 +648,7 @@ private static SnapshotSpan As_Snapshot_Span(Region region, ITextSnapshot snapsh
private void Disable()
{
string filename = AsmDudeToolsStatic.GetFilename(this._buffer);
string msg = string.Format("Performance of CodeFoldingTagger is horrible: disabling folding for {0}.", filename);
string msg = string.Format(AsmDudeToolsStatic.CultureUI, "Performance of CodeFoldingTagger is horrible: disabling folding for {0}.", filename);
AsmDudeToolsStatic.Output_WARNING(msg);

this._enabled = false;
Expand Down
Loading

0 comments on commit 5e72b1a

Please sign in to comment.