GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — further untangling of completion suggestions; yikes · D-I-R-M/processing4@bd901c9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • java/src/processing/mode/java
    • CompletionGenerator.java
    • JavaMode.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎java/src/processing/mode/java/CompletionGenerator.java‎

Copy file name to clipboardExpand all lines: java/src/processing/mode/java/CompletionGenerator.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,13 +1305,13 @@ static protected boolean ignorableSuggestionImport(PreprocSketch ps, String impN
13051305
if (isImported) return false;
13061306

13071307
if (impName.startsWith("processing")) {
1308-
if (JavaMode.checkSuggestion("include", impName)) {
1308+
if (JavaMode.includeSuggestion(impName)) {
13091309
return false;
1310-
} else if (JavaMode.checkSuggestion("exclude", impName)) {
1310+
} else if (JavaMode.excludeSuggestion(impName)) {
13111311
return true;
13121312
}
13131313
} else if (impName.startsWith("java")) {
1314-
if (JavaMode.checkSuggestion("include", impName)) {
1314+
if (JavaMode.includeSuggestion(impName)) {
13151315
return false;
13161316
}
13171317
}
Collapse file

‎java/src/processing/mode/java/JavaMode.java‎

Copy file name to clipboardExpand all lines: java/src/processing/mode/java/JavaMode.java
+26-12Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.HashSet;
3030
import java.util.Map;
3131
import java.util.Set;
32+
import java.util.concurrent.ConcurrentHashMap;
3233

3334
import processing.app.*;
3435
import processing.app.ui.Editor;
@@ -53,6 +54,7 @@ public JavaMode(Base base, File folder) {
5354

5455
// initLogger();
5556
loadPreferences();
57+
loadSuggestionsMap();
5658
}
5759

5860

@@ -239,13 +241,26 @@ public String getSearchPath() {
239241
* Stores the white list/black list of allowed/blacklisted imports.
240242
* These are defined in suggestions.txt in java mode folder.
241243
*/
242-
static private final Map<String, Set<String>> suggestionsMap = new HashMap<>();
244+
static private final Set<String> includedSuggestions = ConcurrentHashMap.newKeySet();
245+
static private final Set<String> excludedSuggestions = ConcurrentHashMap.newKeySet();
246+
243247

248+
static boolean includeSuggestion(String impName) {
249+
return includedSuggestions.contains(impName);
250+
}
244251

252+
253+
static boolean excludeSuggestion(String impName) {
254+
return excludedSuggestions.contains(impName);
255+
}
256+
257+
258+
/*
245259
static boolean checkSuggestion(String mapName, String impName) {
246260
return suggestionsMap.containsKey(mapName) &&
247261
suggestionsMap.get(mapName).contains(impName);
248262
}
263+
*/
249264

250265

251266
public void loadPreferences() {
@@ -264,8 +279,6 @@ public void loadPreferences() {
264279
ccTriggerEnabled = Preferences.getBoolean(COMPLETION_TRIGGER_PREF);
265280
importSuggestEnabled = Preferences.getBoolean(SUGGEST_IMPORTS_PREF);
266281
inspectModeHotkeyEnabled = Preferences.getBoolean(INSPECT_MODE_HOTKEY_PREF);
267-
268-
loadSuggestionsMap();
269282
}
270283

271284

@@ -294,21 +307,22 @@ private void loadSuggestionsMap() {
294307
String[] lines = PApplet.loadStrings(suggestionsFile);
295308
if (lines != null) {
296309
for (String line : lines) {
297-
if (!line.trim().startsWith("#")) {
310+
line = line.trim();
311+
if (line.length() > 0 && !line.startsWith("#")) {
298312
int equals = line.indexOf('=');
299313
if (equals != -1) {
300-
// Looks like multiple versions of the same key are possible,
301-
// so can't just use our Settings class.
302314
String key = line.substring(0, equals).trim();
303-
String val = line.substring(equals + 1).trim();
315+
String value = line.substring(equals + 1).trim();
304316

305-
if (suggestionsMap.containsKey(key)) {
306-
suggestionsMap.get(key).add(val);
317+
if (key.equals("include")) {
318+
includedSuggestions.add(value);
319+
} else if (key.equals("exclude")) {
320+
excludedSuggestions.add(value);
307321
} else {
308-
HashSet<String> set = new HashSet<>();
309-
set.add(val);
310-
suggestionsMap.put(key, set);
322+
Messages.loge("Should be include or exclude: " + key);
311323
}
324+
} else {
325+
Messages.loge("Bad line found in suggestions file: " + line);
312326
}
313327
}
314328
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.