8022 Commits

Author SHA1 Message Date
Jiří Techet
bf17c90bd6 Improve tag searching for "typedef struct {...}" cases
When resolving typedef, search for the subsequent type in the file where
the typedef was defined. For more info see the comment in the patch.
2016-01-10 12:31:47 +01:00
Jiří Techet
13755122f2 Move symbols_get_context_separator() implementation to TM
This way we can use it inside TM.
2016-01-10 12:31:47 +01:00
Jiří Techet
e13aac0dea Remove unused tm_workspace_find_namespace_members()
The implementation of this function is almost the same like the original
m_workspace_find_scoped_members() and there's nothing interesting here
we wouldn't be able to recreate trivially.
2016-01-10 12:31:46 +01:00
Jiří Techet
809a9a7ea5 Merge add_member() and find_scope_members_tags()
By comparing the file pointer in the loop we can speed it up a bit
because we can avoid the strcmp() (this function is the slowest part of
the scope completion based on profiling).

Also move the pointer array creation to this function and return it which
is a bit cleaner.
2016-01-10 12:31:46 +01:00
Jiří Techet
8ff8cbc3a3 Sane implementation of find_scope_members_tags()
Disclaimer: I have absolutely no idea how the original function works.
After gazing into the code for one hour, I just gave up and wrote my own
version of it based on what I think the function should do
but maybe I'm just missing something what justifies the original
implementation's insanity.
2016-01-10 12:31:46 +01:00
Jiří Techet
140a7b6617 When extracting members, get them from single file only
The previous commit fixed the situation when e.g. anon_struct_0 was in the
current file by checking the current file first.

In the case the struct type definition isn't found in the current file,
at the moment we get all members from all anon_struct_0 which can be a
really long list. This list isn't very helpful to users because all the
members from all the structs are mixed. Moreover, not all possible members
are in the list because there are e.g. just members from anon_struct_0 but
not from anon_struct_1 etc. which from the point of view of this function
is a different type.

Instead, restrict the returned members to just a single file (anonymous
structs have unique name per file so it means there will be just one
from the file). Of course the picked file can be wrong and the returned
members might be from a different struct the user wanted but at least
the list will make more sense to users.
2016-01-10 12:31:46 +01:00
Jiří Techet
b6b93036f6 Get scope members only from corresponding tag arrays
At the moment it can happen that even though a member is found in the
currently edited file, the search at the end of the function finds
the type inside another file. This typically happens for anonymous
structs so e.g. for anon_struct_0{...} from the current file we get
members from anon_struct_0{...} from all open documents plus gloabl tags.

Search in an increasing "circle" - start with current file only (trying
all possible types of the variable), continue with workspace array and
finally, if not found, search in the global tags.
2016-01-10 12:31:02 +01:00
Jiří Techet
2328f84e37 Disallow the possibility to use tm_tags_find() on unsorted array
This function won't work correctly on unsorted array because the second
part of the function (after the tags search) expects the array is sorted
by name. The only user of this is tm_source_file_set_tag_arglist() in which
we can go through the tags manually by ourselves (it needs only a single
value so the original behavior of tm_tags_find() wasn't a problem).
Eliminate the tags_search() function as it isn't needed any more.

Just cleanup, not functional change.
2015-07-14 09:46:59 +02:00
Jiří Techet
99e222ea37 Eliminate calls of slow tm_tags_extract() on big arrays
Do the same with struct/class/union... member tags as we do with
typenames - extract them from the edited file and merge them with
the array containing all of them so while editing, there should
be no slowdowns because one file usually doesn't contain so many
tags. This eliminates about 2s freeze when typing "." on a linux
kernel project with 2300000 tags.

Extract typename and member tags also for global tags in case someone
creates a giant tags file - this needs to be done just once when
loading the tag files.

All the remaining tm_tags_extract() in Geany are called on
file tag array only so there shouldn't be any performance problems.
2015-07-14 09:44:33 +02:00
Jiří Techet
5c18b3d132 Improve scoped search
This patch contains a bit too many things which are however related.

It started by the part in editor.c (where we previously used only the
first type we found to perform scoped search) by going through all the
possible variable types until the scoped search returns some result
(this is useful if variable foo is used once as int and once as struct
and if the int is the first type found, we won't get the struct's members).

This didn't work. After an hour of debugging, it turned out that
because tm_workspace_find_scope_members() calls internally
tm_workspace_find() and this function returns static array, this
invalidates the array returned by the tm_workspace_find() used
previously to get all the possible variable types.

Since this is really dangerous and hard to notice, I tried to eliminate
the static returns from both tm_workspace_find() and
tm_workspace_find_scoped_members().

The tm_workspace_find_scoped_members() function is where I got
stuck because as I started to understand what it's doing, I found
many problems there. This patch does the following in this function:

1. Eliminates search_global and no_definitions parameters because
we always search the whole workspace and this simplifies the slightly
strange logic at the end of the function.
2. Returns members from global tags even when something found in
workspace tags - previously global tags were skipped when something
was found from workspace tags but I don't see a reason why.
3. Adds the lang parameter to restrict tags by language (we do this
with normal search and the same should be done here).
4. Previously when searching for types with members the function
returned NULL when more than one such type was found (there should
have been >=1 instead of ==1 at line 906). This patch improves the
logic a bit and if multiple types are found, it tries to use the one
which is other than typedef because it probably has some members (the
typedef can resolve to e.g. int).
5. Previously the function prevented only direct typedef loops like

typedef A B;
typedef B A;

but a loop like A->B->C->A would lead to an infinite cycle. This patch
restricts the number how many times the typedef can be resolved by
using for loop with limited number of repetitions and giving up when
nothing useful is resolved.
6. Finally the patch tries to simplify the function a bit, make it
easier to read and adds some comments to make it clearer what the
function does.
2015-07-14 09:44:33 +02:00
Jiří Techet
ee3eeeb758 Merge tm_workspace_find() and tm_workspace_find_scoped()
They are basically identical except:

1. _scoped() compares scope in addition
2. _scoped() is missing the C/CPP tag compatibility part
3. _scoped() allows returning just single result (unused)
4. _scoped() allows not searching in global tags (unused)

Since we now always put lang also under tag->lang, the match_langs()
function is not necessary.

Extend the add_filtered_tags() (and rename it to fill_find_tags_array()) to
perform the tm_tags_find(), compare the scope and add scope
as parameter of tm_workspace_find() and eliminate tm_workspace_find_scoped()
completely.
2015-07-14 09:44:33 +02:00
Jiří Techet
5c6b423f70 Clean up tm_workspace_find()
1. Factor-out the part common to tags_array and global_tags
2. Get both C/CPP tags when either of the languages is specified (both
for global_tags and tags_array)
3. Remove unnecessary strcmp()s (tm_tags_find() should return only tags
with the specified name)
4. Various minor cleanups
2015-07-14 09:44:33 +02:00
Colomban Wendling
0f5e379ec8 Update making-a-release
* geany.nsi and doc/geany.html are now generated;
* freecode.com is dead.
2015-07-13 00:47:18 +02:00
Colomban Wendling
a50306cab3 Post release version bump
Say hello to Geany 1.26 "Rosset"!
2015-07-12 19:48:50 +02:00
Colomban Wendling
7d9264a6e7 Set release date 2015-07-12 18:04:56 +02:00
Enrico Tröger
ffe7206cc8 Merge pull request #570 from eht16/win32_header_order
Include win32defines.h before win32.h to fix build errors
2015-07-12 15:50:15 +00:00
Enrico Tröger
e5471fb5ce Include win32defines.h before win32.h to fix build errors 2015-07-12 17:40:30 +02:00
Frank Lanitz
59185ae8e0 Update copyright string to reflect year 2015 2015-07-12 17:06:10 +02:00
Frank Lanitz
6c9a55d6ef Update release date inside man-page 2015-07-12 17:05:45 +02:00
Colomban Wendling
290a80ab71 Merge pull request #569 from b4n/spawn-wif-and-doc
Prefix the WIF* macros with SPAWN_ and add short doc comments, and fix
Doxygen integration.
2015-07-12 16:46:47 +02:00
Colomban Wendling
bb28bdd1d3 Fix spawn documentation so it appears in the API docs 2015-07-12 16:32:10 +02:00
Colomban Wendling
feca48b59e spawn: Move macros documentation so Doxygen can find them 2015-07-12 16:32:07 +02:00
Dimitar Zhekov
7819cd11c7 Make the search.c exit status checks platform independent 2015-07-12 17:12:20 +03:00
Dimitar Zhekov
2f237c91a1 Prefix the WIF* macros with SPAWN_ and add short doc comments 2015-07-12 17:06:02 +03:00
Colomban Wendling
64fb9f9a51 Don't return with an argument in a function returning void 2015-07-12 15:27:27 +02:00
Enrico Tröger
f11a2eb013 Merge pull request #563 from geany/elextr-news-addition
Update NEWS to mention windows command quoting
2015-07-12 12:51:12 +00:00
elextr
b891c84582 Update NEWS to mention windows command quoting 2015-07-12 14:42:11 +02:00
Colomban Wendling
5b341b1231 spawn: Fix a typo in Windows compatibility code
Thanks to Dimitar for spotting this.
2015-07-12 14:23:08 +02:00
Colomban Wendling
01b01cc83a Merge pull request #561 from b4n/filebrowser-use-spawn
filebrowser: Use Spawn module to launch the external command
2015-07-12 14:15:30 +02:00
Enrico Tröger
a54cca738f Install src/spawn.h as it is part of the plugin API 2015-07-12 10:02:56 +02:00
Colomban Wendling
c021447394 Fix a few typos in NEWS 2015-07-12 01:48:56 +02:00
Colomban Wendling
676f3794fc Merge pull request #553 from b4n/no-reload-maintain-history-by-default
Disable "maintain history on reload" by default
2015-07-11 22:34:41 +02:00
Colomban Wendling
73822e77ec Merge pull request #556 from b4n/gtk3-in-news
Replace references to GTK2 with GTK+ and "stabilize" GTK3 in NEWS
2015-07-11 22:22:09 +02:00
Colomban Wendling
6c753e591b filebrowser: Use Spawn module to launch the external command
This makes the command syntax consistent with other
Geany ones and more native on Windows.
2015-07-11 22:14:25 +02:00
Colomban Wendling
05f35ed683 Include spawn.h in geanyplugin.h as it has Plugin API bits in it 2015-07-11 22:12:08 +02:00
Enrico Tröger
5379e1387f Windows installer: fix plugin installation directory 2015-07-11 16:36:03 +02:00
Colomban Wendling
d6d4728f2e Rename "maintain history on reload" setting temporarily for 1.25
We want it disabled by default in 1.25 for everyone, but want to be
able to get it back on by default later on when the UI is more
polished.

So we will need to have a way to tell whether the configuration comes
from 1.25 and should be upgraded or was willfully disabled by the user
in a later version.  So, use a temporary setting name that defaults to
disabled for 1.25

See #553.
2015-07-11 15:44:00 +02:00
Colomban Wendling
8c907dc00f Merge pull request #555 from b4n/less-spawn-api
spawn: Do not export unnecessary API
2015-07-11 15:27:02 +02:00
Colomban Wendling
fd06d47c7b Merge pull request #548 from techee/run_script_escape
Properly escape working directory in run script

Closes #554.
2015-07-11 15:10:59 +02:00
Colomban Wendling
860e3fb12e Merge pull request #550 from b4n/fix-ubuntu-libdir
autotools: Workaround a Ubuntu issue when installing in /usr/local/lib
2015-07-11 14:09:58 +02:00
Enrico Tröger
8d367d49b9 Merge pull request #360 from b4n/travis-test
travis: Add a Travis CI settings file
2015-07-11 10:05:30 +02:00
Colomban Wendling
3e2b4a269b travis: Make it a bit easier to change GTK bundle URLs 2015-07-10 23:45:48 +02:00
Colomban Wendling
02e6682ea6 travis: Enable Windows cross-compilation
We unfortunately can't run tests as they require running the just build
(foreign) executable, but at least it tries and build the Windows code
paths.
2015-07-10 23:32:56 +02:00
Colomban Wendling
e0eb176418 Mention that GTK3 version is not experimental anymore 2015-07-10 23:00:22 +02:00
Colomban Wendling
3bd7c80776 Replace references to GTK2 with GTK+
This allows to be GTK version agnostic, not to single out GTK3 builds.
2015-07-10 22:58:48 +02:00
Colomban Wendling
e34421377c spawn: Remove unnecessary and redundant comments 2015-07-10 22:41:02 +02:00
Colomban Wendling
7a91a8661d spawn: Do not export unnecessary API
Hide spawn_get_program_name(), spawn_async_with_pipes() and
spawn_get_exit_status_cb(), which are not used by anyone else and
should not be part of the plugin API unless explicitly required.

See http://lists.geany.org/pipermail/devel/2015-June/thread.html#9521

Note: this duplicates some documentation when a now hidden function was
referred to.
2015-07-10 18:24:23 +02:00
Colomban Wendling
cea34734c4 Update NEWS 2015-07-08 18:39:53 +02:00
Colomban Wendling
96d5eec50f Merge pull request #544 from b4n/cxx11-override
c++: Properly parse C++11 overrides, finals and noexcepts
2015-07-08 18:04:05 +02:00
Colomban Wendling
6f5d5db2cb Disable "maintain history on reload" by default
While the feature is nice, it might be unexpected and lacks user
feedback.  This might lead to user thinking they lost their work
because they don't know they can undo the reload operation.

So, disable the feature by default until we introduce appropriate user
feedback allowing the user to learn about the feature and new behavior.

See http://lists.geany.org/pipermail/devel/2015-June/thread.html#9537
2015-07-08 17:54:34 +02:00