Skip to content

Commit

Permalink
Merge branch 'vimode-fold-support' of https://github.com/scresto09/ge…
Browse files Browse the repository at this point in the history
…any-plugins into vimode-fold-support
  • Loading branch information
scresto09 committed May 22, 2024
2 parents c5e4c30 + 904ee74 commit c9e0413
Show file tree
Hide file tree
Showing 58 changed files with 431 additions and 321 deletions.
43 changes: 37 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ concurrency:
env:
CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration
CONFIGURE_FLAGS: --disable-silent-rules
CPPCHECKFLAGS: --check-level=exhaustive
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 1G
Expand All @@ -36,6 +37,7 @@ jobs:
env:
CC: ccache gcc
CXX: ccache g++
CPPCHECK_CACHE_PATH: ${{ github.workspace }}/.cppcheck_cache
GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source
GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache
GEANY_INSTALLATION_PATH: ${{ github.workspace }}/.geany_cache/_geany_install
Expand All @@ -61,17 +63,28 @@ jobs:
id: ccache_cache_timestamp
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_OUTPUT

- name: Prepare Cppcheck Cache Key
id: prepare_cppcheck_cache_key
run: echo "cppcheck_tag=$(curl -s https://api.github.com/repos/danmar/cppcheck/releases/latest | jq .tag_name)" >> $GITHUB_OUTPUT

- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

- name: Configure ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-

- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure Cppcheck Cache
id: cppcheck_cache
uses: actions/cache@v4
with:
path: ${{ env.CPPCHECK_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-cppcheck-cache-${{ steps.prepare_cppcheck_cache_key.outputs.cppcheck_tag }}

- name: Configure Geany Cache
id: geany_cache
Expand Down Expand Up @@ -102,7 +115,6 @@ jobs:
# geany-plugins
intltool
check
cppcheck
# debugger
libvte-2.91-dev
# geanygendoc
Expand All @@ -126,9 +138,24 @@ jobs:
libxml2-dev
# spellcheck
libenchant-dev
# cppcheck
cmake
libpcre3-dev
EOF
grep -v '^[ ]*#' $RUNNER_TEMP/dependencies | xargs sudo apt-get install --assume-yes --no-install-recommends
- name: Build cppcheck
if: steps.cppcheck_cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.CPPCHECK_CACHE_PATH }}
cd ${{ env.CPPCHECK_CACHE_PATH }}
curl -s https://api.github.com/repos/danmar/cppcheck/releases/latest | jq .tarball_url | xargs wget -O cppcheck.tar.gz
tar --strip-components=1 -xf cppcheck.tar.gz
mkdir build
cd build
cmake .. -DHAVE_RULES=On -DUSE_MATCHCOMPILER=On
cmake --build .
- name: Build Geany
if: steps.geany_cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -142,6 +169,10 @@ jobs:
- name: Configure
run: |
# Add previously built cppcheck to $PATH, for this and for succeeding steps
export "PATH=$PATH:${{ env.CPPCHECK_CACHE_PATH }}/build/bin"
echo "PATH=$PATH" >> "$GITHUB_ENV"
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
Expand All @@ -160,7 +191,7 @@ jobs:
- name: Run distcheck
run: |
cd _build
make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIGURE_FLAGS }}";
make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIGURE_FLAGS }} --disable-cppcheck";
- name: ccache statistics
if: ${{ env.DEBUG == '1' }}
Expand Down
11 changes: 7 additions & 4 deletions addons/src/ao_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,18 +636,21 @@ static void free_update_tasks_for_doc_arguments(gpointer data)

static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc, gboolean clear)
{
AoTasksUpdateTasksForDocArguments *arguments = g_slice_alloc(sizeof *arguments);
arguments->t = t;
arguments->doc = doc;
arguments->clear = clear;
AoTasksUpdateTasksForDocArguments *arguments;

if (!DOC_VALID(doc))
return;

arguments = g_slice_alloc(sizeof *arguments);
arguments->t = t;
arguments->doc = doc;
arguments->clear = clear;

/* Check for task tokens in an idle callback to wait until Geany applied Scintilla highlighting
* styles as we need them to be set before checking for tasks. */
g_idle_add_full(G_PRIORITY_LOW, update_tasks_for_doc_idle_cb, arguments,
free_update_tasks_for_doc_arguments);
/* cppcheck-suppress memleak symbolName=arguments */
}


Expand Down
4 changes: 0 additions & 4 deletions build/cppcheck-geany-plugins.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version="1.0"?>
<def format="2">
<!-- Geany-Plugins macros -->
<define name="PLUGIN" value="&quot;foo&quot;"/>
<!-- GLib macros -->
<define name="G_GSSIZE_FORMAT" value="&quot;li&quot;"/>
<define name="G_GINT64_MODIFIER" value="&quot;l&quot;"/>
<define name="G_DIR_SEPARATOR_S" value="&quot;/&quot;"/>
<define name="G_DEFINE_TYPE(TN, t_n, T_P)" value=""/>
<define name="G_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func)" value=""/>
</def>
6 changes: 6 additions & 0 deletions build/cppcheck.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ if HAVE_CPPCHECK

check-cppcheck: $(srcdir)
$(CPPCHECK) \
--inline-suppr \
-q --template=gcc --error-exitcode=2 \
--library=gtk \
--library=$(top_srcdir)/build/cppcheck-geany-plugins.cfg \
-I$(GEANY_INCLUDEDIR)/geany \
-UGEANY_PRIVATE \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
$(filter -j%,$(MAKEFLAGS)) \
$(LOCAL_AM_CFLAGS) \
$(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \
$(srcdir)

Expand Down
16 changes: 11 additions & 5 deletions build/markdown.m4
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,22 @@ AC_DEFUN([GP_CHECK_MARKDOWN],
[markdown_library=libmarkdown])
GP_STATUS_FEATURE_ADD([Markdown library], [$markdown_library])
GTK_VERSION=2.16
WEBKIT_VERSION=1.1.13
GTK_VERSION=3.0
WEBKIT_VERSION=2.30
dnl Support both webkit2gtk 4.0 and 4.1, as the only difference is the
dnl libsoup version in the API, which we don't use.
dnl Prefer the 4.1 version, but use the 4.0 version as fallback if
dnl available -- yet still ask for the 4.1 if neither are available
webkit_package=webkit2gtk-4.1
PKG_CHECK_EXISTS([${webkit_package} >= ${WEBKIT_VERSION}],,
[PKG_CHECK_EXISTS([webkit2gtk-4.0 >= ${WEBKIT_VERSION}],
[webkit_package=webkit2gtk-4.0])])
GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0],
[webkit_package=webkit-1.0])
GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
$webkit_package >= ${WEBKIT_VERSION}
gthread-2.0])
AM_CONDITIONAL([MARKDOWN_WEBKIT2], [test "$webkit_package" = webkit2gtk-4.0])
GP_COMMIT_PLUGIN_STATUS([Markdown])
Expand Down
20 changes: 14 additions & 6 deletions build/webhelper.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ AC_DEFUN([GP_CHECK_WEBHELPER],
[
GP_ARG_DISABLE([WebHelper], [auto])
GTK_VERSION=2.16
dnl 2.22 for glib-mkenums' @basename@ template
GLIB_VERSION=2.22
GIO_VERSION=2.18
GTK_VERSION=3.0
GLIB_VERSION=2.38
GIO_VERSION=2.30
GDK_PIXBUF_VERSION=2.0
WEBKIT_VERSION=1.1.18
WEBKIT_VERSION=2.18
AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums], [no])
AC_SUBST([GLIB_MKENUMS])
Expand All @@ -19,13 +18,22 @@ AC_DEFUN([GP_CHECK_WEBHELPER],
fi
fi
dnl Support both webkit2gtk 4.0 and 4.1, as the only difference is the
dnl libsoup version in the API, which we don't use.
dnl Prefer the 4.1 version, but use the 4.0 version as fallback if
dnl available -- yet still ask for the 4.1 if neither are available
webkit_package=webkit2gtk-4.1
PKG_CHECK_EXISTS([${webkit_package} >= ${WEBKIT_VERSION}],,
[PKG_CHECK_EXISTS([webkit2gtk-4.0 >= ${WEBKIT_VERSION}],
[webkit_package=webkit2gtk-4.0])])
GP_CHECK_PLUGIN_GTK3_ONLY([webhelper])
GP_CHECK_PLUGIN_DEPS([WebHelper], [WEBHELPER],
[$GP_GTK_PACKAGE >= ${GTK_VERSION}
glib-2.0 >= ${GLIB_VERSION}
gio-2.0 >= ${GIO_VERSION}
gdk-pixbuf-2.0 >= ${GDK_PIXBUF_VERSION}
webkit2gtk-4.0 >= ${WEBKIT_VERSION}
$webkit_package >= ${WEBKIT_VERSION}
gthread-2.0])
Expand Down
6 changes: 6 additions & 0 deletions codenav/src/goto_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion)
if (old_model != NULL)
{ /* Restore the no-sub-directory model */
log_debug("Restoring old model!");

gtk_entry_completion_set_model (completion, old_model);
g_object_unref(old_model);
old_model = NULL;

g_free(curr_dir);
curr_dir = NULL;
}
Expand All @@ -185,7 +188,10 @@ directory_check(GtkEntry* entry, GtkEntryCompletion* completion)

/* Save the completion_mode for future restore. */
if (old_model == NULL)
{
old_model = gtk_entry_completion_get_model(completion);
g_object_ref(old_model);
}

log_debug("New completion list!");

Expand Down
17 changes: 10 additions & 7 deletions geanyctags/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ About

GeanyCtags adds a simple support for generating and querying ctags files for a Geany
project. It requires that the ctags command is installed in a system path. On
unix systems, distributions usually provide the ctags package; on Windows, the
ctags binary can be found in the zip Windows distribution from the ctags home
page (http://ctags.sourceforge.net).
unix systems, distributions usually provide the ctags (original but orphaned
and unmaintained) or universal-ctags (forked and maintained) packages. On Windows,
the universal-ctags binaries can be downloaded from::

https://github.com/universal-ctags/ctags-win32/releases

Even though Geany supports symbol definition searching by itself within the open files
(and with a plugin support within the whole project), tag regeneration can become
Expand Down Expand Up @@ -97,7 +99,7 @@ Downloads

GeanyCtags is part of the combined Geany Plugins release.
For more information and downloads, please visit
http://plugins.geany.org/geany-plugins/
https://plugins.geany.org/geany-plugins/

Development Code
================
Expand All @@ -109,9 +111,10 @@ Get the code from::
Ideas, questions, patches and bug reports
=========================================

Please direct all questions, bug reports and patches to the plugin author using the
email address listed below or to the Geany mailing list to get some help from other
Geany users.
Please direct all questions, bug reports and patches to the combined geany-plugins
project at https://github.com/geany/geany-plugins and open the corresponding
bug report or pull request there. To notify the author of this plugin about
your post, mention him using his github user name (@techee).

2010-2014 by Jiří Techet
techet(at)gmail(dot)com
8 changes: 7 additions & 1 deletion geanyctags/src/geanyctags.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ static void spawn_cmd(const gchar *cmd, const gchar *dir)
msgwin_msg_add(COLOR_BLACK, -1, NULL, "%s", out);
}

/* cppcheck-suppress mismatchAllocDealloc symbolName=argv
* argv is built manually, but is a valid GStrv */
g_strfreev(argv);
g_free(working_dir);
g_free(out);
Expand Down Expand Up @@ -395,6 +397,10 @@ static gboolean find_next(tagFile *tf, tagEntry *entry, MatchType match_type)
return ret;
}

#if ! GLIB_CHECK_VERSION(2, 70, 0)
# define g_pattern_spec_match_string g_pattern_match_string
#endif

static gboolean filter_tag(tagEntry *entry, GPatternSpec *name, gboolean declaration, gboolean case_sensitive)
{
gboolean filter = TRUE;
Expand All @@ -415,7 +421,7 @@ static gboolean filter_tag(tagEntry *entry, GPatternSpec *name, gboolean declara
else
entry_name = g_utf8_strdown(entry->name, -1);

filter = !g_pattern_match_string(name, entry_name);
filter = !g_pattern_spec_match_string(name, entry_name);

g_free(entry_name);

Expand Down
5 changes: 5 additions & 0 deletions geanygendoc/data/filetypes/c.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ doctypes = {
struct.prototype.policy = FORWARD;
member.policy = FORWARD;
enumval.policy = FORWARD;
# usually, locals are just not documented and get in the way
local.policy = FORWARD;

function = {
template = "/**\n * {symbol}:\n{for arg in argument_list} * @{arg}: {cursor}\n{end} * \n * {cursor}\n{if returns} * \n * Returns: \n{end}{if write_since}{if returns} * \n{end} * Since: \n{end} */\n";
Expand Down Expand Up @@ -73,6 +75,9 @@ doctypes = {
}

doxygen = {
# usually, locals are just not documented and get in the way
local.policy = FORWARD;

function.template = "/**\n * {doxygen_prefix}brief {cursor}\n{for a in argument_list} * {doxygen_prefix}param {a} \n{end}{if returns} * {doxygen_prefix}returns \n{end}{if write_since} * {doxygen_prefix}since \n{end} * \n * \n */\n";
macro.template = "/**\n * {doxygen_prefix}brief {cursor}\n{for a in argument_list} * {doxygen_prefix}param {a} \n{end}{if returns} * {doxygen_prefix}returns \n{end}{if write_since} * {doxygen_prefix}since \n{end} * \n * \n */\n";
struct.member = {
Expand Down
2 changes: 2 additions & 0 deletions geanygendoc/docs/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ Known types
A function.
``interface``
An interface.
``local``
A local variable.
``member``
A member (of a structure for example).
``method``
Expand Down
1 change: 1 addition & 0 deletions geanygendoc/src/ggd-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ ggd_opt_group_add_entry (GgdOptGroup *group,

g_array_append_val (group->prefs, entry);

/* cppcheck-suppress memleak symbolName=entry.key */
return &g_array_index (group->prefs, GgdOptEntry, group->prefs->len -1);
}

Expand Down
1 change: 1 addition & 0 deletions geanygendoc/src/ggd-tag-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ static const struct {
{ tm_tag_field_t, "field" },
{ tm_tag_function_t, "function" },
{ tm_tag_interface_t, "interface" },
{ tm_tag_local_var_t, "local" },
{ tm_tag_member_t, "member" },
{ tm_tag_method_t, "method" },
{ tm_tag_namespace_t, "namespace" },
Expand Down
2 changes: 1 addition & 1 deletion geanygendoc/src/ggd.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ get_env_for_tag (GgdFileType *ft,
CtplValue *v;
GList *tmp = children;

if (el->type & setting->matches) {
if (type_name && el->type & setting->matches) {
v = g_hash_table_lookup (vars, type_name);
if (! v) {
v = ctpl_value_new_array (CTPL_VTYPE_STRING, 0, NULL);
Expand Down
Loading

0 comments on commit c9e0413

Please sign in to comment.