Skip to content

Commit c144dc8

Browse files
fix icons
1 parent 035de54 commit c144dc8

8 files changed

Lines changed: 10 additions & 105 deletions

File tree

tools/extensions/CodeQL.VisualStudio/CodeQL.VisualStudio/CodeQL.VisualStudio.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@
153153
<Content Include="icon.png" />
154154
<Resource Include="Icons\db.ico" />
155155
<Resource Include="Icons\Gear.ico" />
156-
<Resource Include="Icons\magnify.ico" />
157-
<Resource Include="Icons\refresh.ico" />
158156
<Resource Include="Icons\stop.ico" />
159157
<Resource Include="Icons\analyze.ico" />
160158
<Resource Include="Icons\select.ico" />

tools/extensions/CodeQL.VisualStudio/CodeQL.VisualStudio/CodeQLPackage.vsct

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@
104104

105105
<Button guid="guidCodeQLCmdSet" id="cmdiCodeQLLoadQueriesCommand" priority="0x0122" type="Button">
106106
<Parent guid="guidCodeQLCmdSet" id="CodeQLSubMenuGroup" />
107-
<Icon guid="IconRefresh" id="IconRefresh16" />
107+
<Icon guid="IconSelect" id="IconSelect16" />
108108
<Strings>
109109
<CommandName>cmdiCodeQLLoadQueriesCommand</CommandName>
110-
<ButtonText>Select Available Query</ButtonText>
111-
<MenuText>Select Available Query</MenuText>
112-
<ToolTipText>Search for all locally available queries and select which to run</ToolTipText>
110+
<ButtonText>Select Available CodeQL Query Suites</ButtonText>
111+
<MenuText>Select Available CodeQL Query Suites</MenuText>
112+
<ToolTipText>Search for all locally available CodeQL query suites and select which to run</ToolTipText>
113113
</Strings>
114114
</Button>
115115

@@ -150,9 +150,9 @@
150150
<Icon guid="IconSelect" id="IconSelect16" />
151151
<Strings>
152152
<CommandName>cmdiCodeQLLoadQueriesCommand</CommandName>
153-
<ButtonText>Select Available Queries</ButtonText>
154-
<MenuText>Select Available Queries</MenuText>
155-
<ToolTipText>Select locally available queries to run</ToolTipText>
153+
<ButtonText>Select Available CodeQL Suites</ButtonText>
154+
<MenuText>Select Available CodeQL Suites</MenuText>
155+
<ToolTipText>Select Locally Available CodeQL Query Suites to Run</ToolTipText>
156156
</Strings>
157157
</Button>
158158
<Button guid="guidCodeQLCmdSet" id="cmdidCodeQLStopCommand" priority="0x0133" type="Button">
@@ -175,7 +175,6 @@
175175
inside a button definition. An important aspect of this declaration is that the element id
176176
must be the actual index (1-based) of the bitmap inside the bitmap strip. -->
177177
<Bitmap guid="IconAnalyze" href="Icons\\analyze.ico" usedList="IconAnalyze16"/>
178-
<Bitmap guid="IconRefresh" href="Icons\\refresh.ico" usedList="IconRefresh16"/>
179178
<Bitmap guid="IconStop" href="Icons\\stop.ico" usedList="IconStop16"/>
180179
<Bitmap guid="IconSelect" href="Icons\\select.ico" usedList="IconSelect16"/>
181180
<Bitmap guid="IconGear" href="Icons\\Gear.ico" usedList="IconGear48"/>
@@ -211,10 +210,6 @@
211210
<IDSymbol name="IconAnalyze16" value="1" />
212211
</GuidSymbol>
213212

214-
<GuidSymbol name="IconRefresh" value="{FFA9D4AC-7B75-4117-AB06-D3D38E3B4388}">
215-
<IDSymbol name="IconRefresh16" value="1"/>
216-
</GuidSymbol>
217-
218213
<GuidSymbol name="IconStop" value="{7A6F12D2-D2BE-47FD-8B42-BDE56E0C03ED}">
219214
<IDSymbol name="IconStop16" value="1"/>
220215
</GuidSymbol>

tools/extensions/CodeQL.VisualStudio/CodeQL.VisualStudio/CodeQLRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public async Task<List<string>> FindQueriesAsync(string qlpack, bool queriesNSui
378378
string query = line.Replace("\"", string.Empty).Replace("\\\\", "/").Replace("\\", "/").Trim(',').Trim();
379379
if (!IsExclusion(query))
380380
{
381-
queries.Add(query);
381+
queries.Add(query.Substring(query.IndexOf("packages"))); // display packages from root of pack, not from root of filesystem
382382
}
383383
}
384384
}

tools/extensions/CodeQL.VisualStudio/CodeQL.VisualStudio/CodeQLService.cs

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -176,102 +176,14 @@ public async Task CancelIfRunningAsync()
176176
}
177177
await ProjectHelper.HideProgressAsync();
178178
}
179-
private void HandleKeyCollision(string existingKey, string newValue)
180-
{
181-
if (_queryDict[existingKey].Equals(newValue))
182-
{
183-
return;
184-
}
185-
StringBuilder replacementKey = new StringBuilder();
186-
StringBuilder newValueKey = new StringBuilder();
187-
List<string> existingValueParts = _queryDict[existingKey].Split('/').ToList();
188-
List<string> newValueParts = newValue.Split('/').ToList();
189-
while ((existingValueParts.Count > 0 && newValueParts.Count > 0) &&
190-
existingValueParts.Last().Equals(newValueParts.Last()))
191-
{
192-
replacementKey.Insert(0, "/" + existingValueParts.Last() );
193-
existingValueParts.RemoveAt(existingValueParts.Count - 1);
194-
newValueKey.Insert(0, "/" + newValueParts.Last());
195-
newValueParts.RemoveAt(newValueParts.Count - 1);
196-
}
197-
198-
// add remaining unique value
199-
if (newValueParts.Count > 0 && existingValueParts.Count > 0) {
200-
newValueKey.Insert(0, newValueParts.Last());
201-
replacementKey.Insert(0, existingValueParts.Last());
202-
203-
// if at a version, try to get the qlpack for it which should be the preceding two segments
204-
if(Version.TryParse(newValueParts.Last(), out _) && newValueParts.Count > 2)
205-
{
206-
newValueKey.Insert(0, newValueParts.ElementAt(newValueParts.Count - 3) +"/" +
207-
newValueParts.ElementAt(newValueParts.Count - 2) + "/");
208-
}
209-
if (Version.TryParse(existingValueParts.Last(), out _) && existingValueParts.Count > 2)
210-
{
211-
replacementKey.Insert(0, existingValueParts.ElementAt(existingValueParts.Count - 2) + "/" +
212-
existingValueParts.ElementAt(existingValueParts.Count - 2) + "/");
213-
}
214-
}
215-
else
216-
{
217-
throw new Exception("Unable to find new key");
218-
}
219-
220-
if (newValueKey.ToString().Equals(replacementKey.ToString()))
221-
{
222-
throw new Exception("Unable to find new key");
223-
}
224-
_queryDict.Remove(existingKey);
225-
if (!_queryDict.ContainsKey(replacementKey.ToString()))
226-
{
227-
_queryDict.Add(replacementKey.ToString(), string.Join("/", existingValueParts));
228-
}
229-
if (!_queryDict.ContainsKey(replacementKey.ToString()))
230-
{
231-
_queryDict.Add(newValueKey.ToString(), newValue);
232-
}
233-
}
234-
179+
235180
public async Task<ObservableCollection<string>> FindAvailableQueriesAsync()
236181
{
237182
List<string> packList = await CodeQLRunner.Instance.FindPacksAsync(CodeQLGeneralOptions.Instance.AdditionalQueryLocations);
238183
List<string> queryList = await CodeQLRunner.Instance.FindQueriesAsync(packList, queriesNSuites: false);
239-
foreach (string query in queryList)
240-
{
241-
string key = query.Replace("\\", "/").Split('/').Last();
242-
if (_queryDict.ContainsKey(key))
243-
{
244-
HandleKeyCollision(key, query);
245-
}
246-
else
247-
{
248-
_queryDict.Add(key, query.Replace("\\", "/"));
249-
}
250-
}
251-
252-
return new ObservableCollection<string>(_queryDict.Keys);
184+
return new ObservableCollection<string>(queryList.ToHashSet());
253185
}
254186

255-
public void AddAdditionalQueries(List<string> queries)
256-
{
257-
foreach (string query in queries)
258-
{
259-
string key = query.Replace("\\", "/").Split('/').Last();
260-
if (!_queryDict.ContainsKey(key))
261-
{
262-
_queryDict.Add(key, query.Replace("\\", "/"));
263-
}
264-
}
265-
}
266-
267-
public void RemoveQuery(string query)
268-
{
269-
string key = query.Replace("\\", "/").Split('/').Last();
270-
if (_queryDict.ContainsKey(key))
271-
{
272-
_queryDict.Remove(key);
273-
}
274-
}
275187

276188
public async Task UpdateDatabaseBuildInfoAsync()
277189
{
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)