Skip to content

Commit

Permalink
Fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Jan 7, 2019
1 parent 16d18bb commit 3ca182d
Show file tree
Hide file tree
Showing 46 changed files with 1,029 additions and 956 deletions.
8 changes: 2 additions & 6 deletions VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocMouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using System.Windows;
using System.Windows.Input;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
Expand Down Expand Up @@ -402,7 +401,7 @@ private static void Evaluate(EnvDTE.Window WindowReference, Action<System.Window
{
try
{
OnEvaluate.Invoke((System.Windows.Forms.WebBrowser)Browser);
OnEvaluate.Invoke(Browser);
}
catch { }
}
Expand All @@ -418,10 +417,7 @@ private static void Evaluate(EnvDTE.Window WindowReference, Action<System.Window
public static Uri GetWebBrowserWindowUrl(EnvDTE.Window WindowReference)
{
Uri BrowserUrl = new Uri("", UriKind.RelativeOrAbsolute);
Evaluate(WindowReference, new Action<System.Windows.Forms.WebBrowser>((wb) =>
{
BrowserUrl = wb.Url;
}));
Evaluate(WindowReference, new Action<System.Windows.Forms.WebBrowser>((wb) => BrowserUrl = wb.Url));
return BrowserUrl;
}
protected override void AttachInterfaces(object nativeActiveXObject)
Expand Down
12 changes: 0 additions & 12 deletions VS/CSHARP/asm-dude-vsix/AsmDudePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ protected override async System.Threading.Tasks.Task InitializeAsync(Cancellatio
{
await base.InitializeAsync(cancellationToken, progress);
ClearMefCache.ClearMefCache.Initialize(this);

StringBuilder sb = new StringBuilder();
sb.Append("Welcome to\n");
sb.Append(" _____ ____ _ \n");
sb.Append("| _ |___ _____ | \\ _ _ _| |___ \n");
sb.Append("| |_ -| | | | | | | . | -_|\n");
sb.Append("|__|__|___|_|_|_| |____/|___|___|___|\n");
sb.Append("INFO: Loaded AsmDude version " + typeof(AsmDudePackage).Assembly.GetName().Version + " (" + ApplicationInformation.CompileDate.ToString() + ")\n");
sb.Append("INFO: Open source assembly extension. Making programming in assembler almost bearable.\n");
sb.Append("INFO: More info at https://github.com/HJLebbink/asm-dude \n");
sb.Append("----------------------------------");
await AsmDudeToolsStatic.OutputAsync(sb.ToString());
}

#region Disassembly window experiments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public IEnumerable<ITagSpan<TextMarkerTag>> GetTags(NormalizedSnapshotSpanCollec
var open = from n in this._braceList
where n.Value.Equals(lastText)
select n.Key;
if (FindMatchingOpenChar(lastChar, (char)open.ElementAt(0), lastText, this._view.TextViewLines.Count, out pairSpan) == true) {
if (FindMatchingOpenChar(lastChar, open.ElementAt(0), lastText, this._view.TextViewLines.Count, out pairSpan) == true) {
yield return new TagSpan<TextMarkerTag>(new SnapshotSpan(lastChar, 1), new TextMarkerTag("blue"));
yield return new TagSpan<TextMarkerTag>(pairSpan, new TextMarkerTag("blue"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;

Expand Down Expand Up @@ -68,6 +69,8 @@ public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pv

private int ExecMethod1(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
{
ThreadHelper.ThrowIfNotOnUIThread();

//Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "INFO: {0}:Exec", this.ToString()));
char typedChar = char.MinValue;

Expand Down Expand Up @@ -142,6 +145,7 @@ private int ExecMethod1(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, I

private int ExecMethod2(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
{
ThreadHelper.ThrowIfNotOnUIThread();
//AsmDudeToolsStatic.Output_INFO(string.Format("{0}:ExecMethod2", this.ToString()));

bool handledChar = false;
Expand Down Expand Up @@ -310,6 +314,7 @@ 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()));
if (pguidCmdGroup == VSConstants.VSStd2K)
{
Expand Down
28 changes: 14 additions & 14 deletions VS/CSHARP/asm-dude-vsix/CodeCompletion/CodeCompletionSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
//2] find the start of the current keyword
#region
SnapshotPoint start = triggerPoint;
while ((start > line.Start) && !AsmTools.AsmSourceTools.IsSeparatorChar((start - 1).GetChar()))
while ((start > line.Start) && !AsmSourceTools.IsSeparatorChar((start - 1).GetChar()))
{
start -= 1;
}
Expand Down Expand Up @@ -133,24 +133,24 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
{
// Suggest a label
var completions = this.Label_Completions(useCapitals, false);
if (completions.Any<Completion>()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));
if (completions.Any()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));
}
else
{
{
ISet<AsmTokenType> selected1 = new HashSet<AsmTokenType> { AsmTokenType.Directive, AsmTokenType.Jump, AsmTokenType.Misc, AsmTokenType.Mnemonic };
var completions1 = this.Selected_Completions(useCapitals, selected1, true);
if (completions1.Any<Completion>()) completionSets.Add(new CompletionSet("All", "All", applicableTo, completions1, Enumerable.Empty<Completion>()));
if (completions1.Any()) completionSets.Add(new CompletionSet("All", "All", applicableTo, completions1, Enumerable.Empty<Completion>()));
}
if (false) {
ISet<AsmTokenType> selected2 = new HashSet<AsmTokenType> { AsmTokenType.Jump, AsmTokenType.Mnemonic };
var completions2 = this.Selected_Completions(useCapitals, selected2, false);
if (completions2.Any<Completion>()) completionSets.Add(new CompletionSet("Instr", "Instr", applicableTo, completions2, Enumerable.Empty<Completion>()));
if (completions2.Any()) completionSets.Add(new CompletionSet("Instr", "Instr", applicableTo, completions2, Enumerable.Empty<Completion>()));
}
if (false) {
ISet<AsmTokenType> selected3 = new HashSet<AsmTokenType> { AsmTokenType.Directive, AsmTokenType.Misc };
var completions3 = this.Selected_Completions(useCapitals, selected3, true);
if (completions3.Any<Completion>()) completionSets.Add(new CompletionSet("Directive", "Directive", applicableTo, completions3, Enumerable.Empty<Completion>()));
if (completions3.Any()) completionSets.Add(new CompletionSet("Directive", "Directive", applicableTo, completions3, Enumerable.Empty<Completion>()));
}
}
}
Expand All @@ -163,14 +163,14 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
//AsmDudeToolsStatic.Output_INFO("CodeCompletionSource:AugmentCompletionSession; previous keyword is a jump mnemonic");
// previous keyword is jump (or call) mnemonic. Suggest "SHORT" or a label
var completions = this.Label_Completions(useCapitals, true);
if (completions.Any<Completion>()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));
if (completions.Any()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));

}
else if (previousKeyword.Equals("SHORT") || previousKeyword.Equals("NEAR"))
{
// Suggest a label
var completions = this.Label_Completions(useCapitals, false);
if (completions.Any<Completion>()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));
if (completions.Any()) completionSets.Add(new CompletionSet("Labels", "Labels", applicableTo, completions, Enumerable.Empty<Completion>()));
}
else
{
Expand All @@ -191,7 +191,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
}
}
var completions = this.Mnemonic_Operand_Completions(useCapitals, allowed, line.LineNumber);
if (completions.Any<Completion>()) completionSets.Add(new CompletionSet("All", "All", applicableTo, completions, Enumerable.Empty<Completion>()));
if (completions.Any()) completionSets.Add(new CompletionSet("All", "All", applicableTo, completions, Enumerable.Empty<Completion>()));
}
}
#endregion
Expand Down Expand Up @@ -236,7 +236,7 @@ private IEnumerable<Completion> Mnemonic_Operand_Completions(bool useCapitals, I
//AsmDudeToolsStatic.Output_INFO("AsmCompletionSource:AugmentCompletionSession: keyword \"" + keyword + "\" is added to the completions list");

// by default, the entry.Key is with capitals
string insertionText = (useCapitals) ? keyword : keyword.ToLower();
string insertionText = useCapitals ? keyword : keyword.ToLower();
string archStr = (arch == Arch.ARCH_NONE) ? "" : " [" + ArchTools.ToString(arch) + "]";
string descriptionStr = this._asmDudeTools.Get_Description(keyword);
descriptionStr = (descriptionStr.Length == 0) ? "" : " - " + descriptionStr;
Expand Down Expand Up @@ -278,7 +278,7 @@ private IEnumerable<Completion> Mnemonic_Operand_Completions(bool useCapitals, I
//AsmDudeToolsStatic.Output_INFO("AsmCompletionSource:AugmentCompletionSession: keyword \"" + keyword + "\" is added to the completions list");

// by default, the entry.Key is with capitals
string insertionText = (useCapitals) ? keyword2 : keyword2.ToLower();
string insertionText = useCapitals ? keyword2 : keyword2.ToLower();
string archStr = (arch == Arch.ARCH_NONE) ? "" : " [" + ArchTools.ToString(arch) + "]";
string descriptionStr = this._asmDudeTools.Get_Description(keyword);
descriptionStr = (descriptionStr.Length == 0) ? "" : " - " + descriptionStr;
Expand All @@ -300,8 +300,8 @@ private IEnumerable<Completion> Label_Completions(bool useCapitals, bool addSpec
{
if (addSpecialKeywords)
{
yield return new Completion("SHORT", (useCapitals) ? "SHORT" : "short", null, this._icons[AsmTokenType.Misc], "");
yield return new Completion("NEAR", (useCapitals) ? "NEAR" : "near", null, this._icons[AsmTokenType.Misc], "");
yield return new Completion("SHORT", useCapitals ? "SHORT" : "short", null, this._icons[AsmTokenType.Misc], "");
yield return new Completion("NEAR", useCapitals ? "NEAR" : "near", null, this._icons[AsmTokenType.Misc], "");
}

ImageSource imageSource = this._icons[AsmTokenType.Label];
Expand Down Expand Up @@ -352,7 +352,7 @@ private IEnumerable<Completion> Selected_Completions(bool useCapitals, ISet<AsmT
{
string keyword = mnemonic.ToString();
string description = this._asmDudeTools.Mnemonic_Store.GetSignatures(mnemonic).First().Documentation;
string insertionText = (useCapitals) ? keyword : keyword.ToLower();
string insertionText = useCapitals ? keyword : keyword.ToLower();
string archStr = ArchTools.ToString(this._asmDudeTools.Mnemonic_Store.GetArch(mnemonic));
string descriptionStr = this._asmDudeTools.Mnemonic_Store.GetDescription(mnemonic);
descriptionStr = (descriptionStr.Length == 0) ? "" : " - " + descriptionStr;
Expand Down Expand Up @@ -400,7 +400,7 @@ private IEnumerable<Completion> Selected_Completions(bool useCapitals, ISet<AsmT
//Debug.WriteLine("INFO: CompletionSource:AugmentCompletionSession: name keyword \"" + entry.Key + "\"");

// by default, the entry.Key is with capitals
string insertionText = (useCapitals) ? keyword : keyword.ToLower();
string insertionText = useCapitals ? keyword : keyword.ToLower();
string archStr = (arch == Arch.ARCH_NONE) ? "" : " [" + ArchTools.ToString(arch) + "]";
string descriptionStr = this._asmDudeTools.Get_Description(keyword);
descriptionStr = (descriptionStr.Length == 0) ? "" : " - " + descriptionStr;
Expand Down
3 changes: 2 additions & 1 deletion VS/CSHARP/asm-dude-vsix/CodeFolding/CodeFoldingTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using Microsoft.VisualStudio.Shell;
using AsmTools;
using Amib.Threading;
using Microsoft.VisualStudio.Threading;

namespace AsmDude.CodeFolding
{
Expand Down Expand Up @@ -628,7 +629,7 @@ private static SnapshotSpan As_Snapshot_Span(Region region, ITextSnapshot snapsh

private void Disable()
{
string filename = AsmDudeToolsStatic.Get_Filename_Async(this._buffer).Result;
string filename = AsmDudeToolsStatic.GetFilename(this._buffer);
string msg = string.Format("Performance of CodeFoldingTagger is horrible: disabling folding for {0}.", filename);
AsmDudeToolsStatic.Output_WARNING(msg);

Expand Down
Loading

0 comments on commit 3ca182d

Please sign in to comment.