Skip to content

Commit 915ff1c

Browse files
authored
Merge branch 'master' into jeremypw/vala-symbol-pane/remove-unneeded-check
2 parents 69a1461 + 857a871 commit 915ff1c

614 files changed

Lines changed: 29881 additions & 16332 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/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module_name = 'word-completion'
22

33
module_files = [
44
'prefix-tree.vala',
5+
'prefix-tree-node.vala',
56
'completion-provider.vala',
67
'engine.vala',
78
'plugin.vala'
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright 2024 elementary, Inc. <https://elementary.io>
3+
* 2011 Lucas Baudin <xapantu@gmail.com>
4+
* *
5+
* This is a free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License as
7+
* published by the Free Software Foundation; either version 2 of the
8+
* License, or (at your option) any later version.
9+
*
10+
* This is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public
16+
* License along with this program; see the file COPYING. If not,
17+
* write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18+
* Boston, MA 02110-1301 USA.
19+
*
20+
*/
21+
22+
public class Scratch.Plugins.PrefixNode : Object {
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; }
35+
public unichar value { get; construct; }
36+
37+
public Gee.ArrayList<PrefixNode> children;
38+
39+
public PrefixNode.from_unichar (unichar c, PrefixNode? _parent) requires (c != WORD_END_CHAR) {
40+
Object (
41+
value: c,
42+
parent: _parent,
43+
uc: c,
44+
node_type: NodeType.CHAR
45+
);
46+
}
47+
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+
66+
construct {
67+
children = new Gee.ArrayList<PrefixNode> ();
68+
}
69+
}

plugins/word-completion/prefix-tree.vala

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11

22
namespace Scratch.Plugins {
3-
private class PrefixNode : Object {
4-
public GLib.List<PrefixNode> children;
5-
public unichar value { get; set; }
6-
7-
construct {
8-
children = new List<PrefixNode> ();
9-
}
10-
}
11-
123
public class PrefixTree : Object {
134
private PrefixNode root;
145

@@ -17,9 +8,7 @@ namespace Scratch.Plugins {
178
}
189

1910
public void clear () {
20-
root = new PrefixNode () {
21-
value = '\0'
22-
};
11+
root = new PrefixNode ();
2312
}
2413

2514
public void insert (string word) {
@@ -47,10 +36,9 @@ namespace Scratch.Plugins {
4736
}
4837
}
4938

50-
var new_child = new PrefixNode () {
51-
value = curr
52-
};
53-
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) => {
5442
if (c1.value > c2.value) {
5543
return 1;
5644
} else if (c1.value == c2.value) {

po/POTFILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ src/Dialogs/GlobalSearchDialog.vala
55
src/Dialogs/NewBranchDialog.vala
66
src/Dialogs/PreferencesDialog.vala
77
src/Dialogs/RestoreConfirmationDialog.vala
8+
src/Dialogs/CloseProjectsConfirmationDialog.vala
9+
src/Dialogs/OverwriteUncommittedConfirmationDialog.vala
810
src/FolderManager/File.vala
911
src/FolderManager/FileItem.vala
1012
src/FolderManager/FileView.vala

0 commit comments

Comments
 (0)