Skip to content

Commit f2ec425

Browse files
authored
Merge branch 'master' into jeremypw/load-large-folders-faster
2 parents 16bf137 + 522235c commit f2ec425

608 files changed

Lines changed: 16665 additions & 16138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data/io.elementary.code.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@
152152
<summary>Remember the last focused document.</summary>
153153
<description>Restore the focused document from a previous session when opening Code.</description>
154154
</key>
155+
<key name="active-project-path" type="s">
156+
<default>''</default>
157+
<summary>The active project path.</summary>
158+
<description>The path to the folder containing the active project.</description>
159+
</key>
155160
<key name="default-build-directory" type="s">
156161
<default>''</default>
157162
<summary>The default build directory's relative path.</summary>

plugins/word-completion/prefix-tree-node.vala

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,50 @@
2020
*/
2121

2222
public class Scratch.Plugins.PrefixNode : Object {
23-
public GLib.List<PrefixNode> children;
23+
public enum NodeType {
24+
ROOT,
25+
CHAR,
26+
WORD_END
27+
}
28+
29+
private const unichar WORD_END_CHAR = '\0';
30+
private uint occurrences; // Only used for WORD_END nodes
31+
32+
public unichar uc { get; construct; }
33+
public NodeType node_type { get; construct; }
34+
public PrefixNode? parent { get; construct; }
2435
public unichar value { get; construct; }
2536

26-
public PrefixNode (unichar c = '\0') {
37+
public Gee.ArrayList<PrefixNode> children;
38+
39+
public PrefixNode.from_unichar (unichar c, PrefixNode? _parent) requires (c != WORD_END_CHAR) {
2740
Object (
28-
value: c
41+
value: c,
42+
parent: _parent,
43+
uc: c,
44+
node_type: NodeType.CHAR
2945
);
3046
}
3147

48+
public PrefixNode.root () {
49+
Object (
50+
parent: null,
51+
uc: WORD_END_CHAR,
52+
node_type: NodeType.ROOT
53+
);
54+
}
55+
56+
public PrefixNode.word_end (PrefixNode _parent) {
57+
Object (
58+
parent: _parent,
59+
uc: WORD_END_CHAR,
60+
node_type: NodeType.WORD_END
61+
);
62+
63+
occurrences = 1;
64+
}
65+
3266
construct {
33-
children = new List<PrefixNode> ();
67+
children = new Gee.ArrayList<PrefixNode> ();
3468
}
3569
}

plugins/word-completion/prefix-tree.vala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ namespace Scratch.Plugins {
3636
}
3737
}
3838

39-
var new_child = new PrefixNode (curr);
40-
node.children.insert_sorted (new_child, (c1, c2) => {
39+
var new_child = new PrefixNode.from_unichar (curr, null);
40+
node.children.insert (0, new_child);
41+
node.children.sort ((c1, c2) => {
4142
if (c1.value > c2.value) {
4243
return 1;
4344
} else if (c1.value == c2.value) {

0 commit comments

Comments
 (0)