8491 Commits

Author SHA1 Message Date
Jiří Techet
5b4c6f96b2 Don't use anon_struct_* and similar members unless we are sure it's the right one
We can only be sure it's the right one if we previously resolved a
typedef to it and the typedef was in the same file.
2016-01-18 22:56:10 +01:00
Jiří Techet
02105d77d7 Simplify tag type specifications in scope search
Consider types with members to have the same properties everywhere (this
might differ language to language but this assumption should behave
reasonably for any language).

Don't check member type in find_scope_members_tags() - we already check
scope which should be sufficient and will work even if some language
uses function/variable instead of method/member/field.
2016-01-18 22:56:10 +01:00
Jiří Techet
67916dc403 Use only binary search to find first/last element in a row of equal tags
The linear part may become expensive when there are many equal tags
which can happen when partial search, used for non-scope completion,
is used.
2016-01-18 22:56:10 +01:00
Jiří Techet
2682d7973f Remove anon_* elements when performing namespace search
These correspond to anonymous structs, enums, etc. but they don't have
any name so the name shouldn't be listed.
2016-01-18 22:56:10 +01:00
Jiří Techet
7a3d6a4ee1 Filter scope autocompletion list based on user input
When scope autocompletion list shows, start filtering it when
when the user types some more characters. As long as the list
is non-empty, don't switch to normal autocompletion and show
only the scope autocompletion results.
2016-01-18 22:56:10 +01:00
Jiří Techet
932dc71fe2 Don't use struct/class/... member types when the edited text isn't a member
For instance, consider

class A {
    int a;
    int b;
}

class B {
    A c;
    void foo() {
        c.    //<---- (3)
    }
}

int main() {
    c.    //<---- (1)
    foo.c.    //<---- (2)
}

Consider cases (1) and (2) first - in the case (1) scope completion
shouldn't be performed because c isn't a global variable; however,
in case (2) it should be performed because c is a member.

To fix this, we can check whether the typed variable ('c' in this case)
is preceeded by another dot - if it is, use member tags for scope
completion; otherwise don't use them.

There's one exception from this rule - in the case (3) we are accessing
a member variable from a member function at the same scope so the
function should have access to the variable. For this we can use the
scope at the position of the cursor. It should be

B::foo

in this case, more generally ...::class_name::function_name. We need
to check if class_name exists at the given scope and if the member
variable we are trying to access is inside ...::class_name - if so,
scope completion can be performed using member tags (without explicit
invocation on a member).
2016-01-18 22:55:02 +01:00
Colomban Wendling
99938dd821 Update Scintilla to version 3.6.3
Includes improvements for Lua 5.3 and Perl 5.22.
2016-01-18 04:22:26 +01:00
Daniel Șuteu
f3a5dd609a Add file-extensions for Clojure
The extensions are from Wikipedia: https://en.wikipedia.org/wiki/Clojure

Closes #842.
2016-01-18 03:43:35 +01:00
Colomban Wendling
bfd5587f4f Merge pull request #852 from b4n/reflow-hang
Fix hang in reflow command (and small improvements around)
2016-01-18 03:40:56 +01:00
Colomban Wendling
50212093ba Merge pull request #831 from b4n/cuda/tags
CUDA: Use C++ ctags parser
2016-01-18 03:34:02 +01:00
Colomban Wendling
a7ce20dc59 Merge pull request #826 from kugel-/doxygen-fixes2
Doxygen API fixes and cleanup.
2016-01-18 03:19:15 +01:00
Thomas Martitz
9f6f6cfb78 gir: keybindings: adhere to user_data naming convention
This helps g-ir-scanner recognizing the data parameter as context storage,
allowing object methods to be used as callback (via wrappers). It goes even
so far that g_object_unref is propery passed as destroy func to
keybindings_set_item_full() and plugin_set_key_group_full().
2016-01-17 14:13:45 +01:00
Colomban Wendling
1c4a9d8dd3 C++: Fix parsing of global scope qualifiers in base class lists
See also https://sourceforge.net/p/ctags/bugs/194/

I didn't use the exact upstream patch only altering the C++ code path,
because as far as I know no c.c language recognize two consecutive
colons separated by whitespace as a single token, so there's no point
in carrying on mistakes from the past.
2016-01-17 04:03:24 +01:00
Colomban Wendling
440a736018 C++, C#: Properly set scope on namespaces
Closes #871.
2016-01-17 03:30:06 +01:00
Colomban Wendling
6e0d4ac6ec Merge pull request #581 from techee/symbollist_sort
Make it possible to define default symbol_list_sort_mode
2016-01-13 17:43:03 +01:00
Thomas Martitz
740ecb00fb doxygen: fix doxygen warnings about filetypes_array references. 2016-01-12 07:15:54 +01:00
Jiří Techet
1ea072e125 Make it possible to define default symbol_list_sort_mode
Both sorting by name and appearance makes sense for most languages. Some
users may prefer sorting by appearance so make it configurable in
preferences (the possibility to override the settings for specific
filetypes is preserved).

Thanks to Colomban Wendling for lots of improvements of this patch.

Fixes #313.
2016-01-11 23:36:50 +01:00
Colomban Wendling
e7429d4cdb Merge branch 'gb-new'
Nothing to see here, is there :)
2016-01-11 02:31:01 +01:00
Jiří Techet
e0122592d9 Perform scope autocompletion based on function return types
We just need to skip the (...) and perform autocompletion as before.

Shift pos by 1 in the whole function so we don't have to look 2 characters
back (makes the function easier to read).

Functions contain pointers in their return values - remove them before
searching for the type.

Also restrict the searched variable/function/type tags a bit only to
types which make sense for the search.
2016-01-10 12:36:08 +01:00
Jiří Techet
4bc5f4a7e4 Popup scope autocompletion dialog in more cases
* for PHP and Rust scope separator ::
* when there's more than one whitespace between the identifier and operator
2016-01-10 12:36:08 +01:00
Jiří Techet
c4b1cd4938 Perform "namespace" search (autocomplete for A:: where A is a type)
In principle this is very similar to the normal scope search. If the
provided name belongs to a type that can contain members (contrary to a
variable in scope search), perform the namespace search. With namespace
search show all possible members that are at the given scope.

Since we perform the scope search at file level, don't perform the
namespace search for tags that can span multiple files otherwise we get
incomplete results which could be confusing to users. This involves
namespaces and packages.
2016-01-10 12:36:05 +01:00
Jiří Techet
1281d0c942 Get members from the same file as the type/struct/union
Rethink how to extract members from the struct types. Inspired by
the patch using the same file as the typedef to search for structs,
we can do the same to extract the members only from the file
containing the struct and not the whole workspace. This makes
this operation fast enough so we don't have to keep the extracted
members in a special array (this will become especially useful
for namespace search because for it we would have to extract
all tags and then the extracted array would have the same
size as the workspace so we'd lose the performance gain).

Since the above works only for tags having the file information,
that is, not the global tags, we'll lose some performance
when searching the global tags. I think people don't create
the tag files for complete projects but rather for header files
which contain less tags and still the performance should be
better than before this patch set because we go through the
global tag list only once (was twice before).

On the way, clean up the source a bit, add more comments and move
some code from find_scope_members() to find_scope_members_tags().
2016-01-10 12:33:40 +01:00
Jiří Techet
30fa28bac7 Don't use enums for scoped search
Even though enums contain members, their members are accessed in a
different way than members of classes and structs. E.g. consider:

typedef enum {A, B, C, D} MyEnum;

Variable of this type is declared as

MyEnum myVar;

myVar can be assigned a value from MyEnum; however, we don't access myVar
over the dot operator so we don't need the list of all members after
typing

myVar.

This patch eliminates some false positives after typing .
2016-01-10 12:31:47 +01:00
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
Colomban Wendling
4d4573c5d8 Merge pull request #855 from techee/changelog
Concatenate ChangeLog.pre-0-17 and ChangeLog.pre-1-22
2016-01-09 20:18:29 +01:00
Colomban Wendling
28f7c169fc Merge pull request #652 from b4n/kb/file-properties
Allow to set a keybinding for File->Properties
2016-01-09 20:07:23 +01:00
Colomban Wendling
8099fddd92 Remove leftover references to SVN
Closes #856.
2016-01-09 19:59:09 +01:00
Jiří Techet
5620c7df32 Concatenate ChangeLog.pre-0-17 and ChangeLog.pre-1-22
These files aren't updated (and probably read by anyone) any more and
it's better to have less "garbage" files in the root.
2016-01-06 21:52:46 +01:00
Colomban Wendling
4a2890667e vhdl: Fix a typo
This has no actual impact as the kind is not used anywhere anyway.

Part of #849.
2016-01-06 14:30:03 +01:00
Frank Lanitz
001fd5c52f Merge pull request #849 from BenWiederhake/master
Fix a huge amount of type inside overall Geany
2016-01-06 10:56:51 +01:00
Jiří Techet
7fcda040ab Fix various utf8/locale problems in build and message window
Non-ascii characters in file/directory names caused:

1. build commands didn't succeed
2. characters in the message window weren't shown in correct encoding
3. clicking on a row with error in the message window didn't open the file
with error.

This patch fixes these three issues.
2016-01-05 17:36:46 +01:00
Colomban Wendling
e083c8d1c9 reflow: Use plain ASCII space instead of GDK_space
`GDK_space` is not guaranteed to have the value of an ASCII space
(although it does in practice), and using a GDK constant does not make
sense inside a text manipulation function.
2016-01-04 22:30:32 +01:00
Colomban Wendling
ffde79e8ef reflow: Don't split right before a whitespace
Avoid splitting lines right before a whitespace when reflowing (e.g.
in case of several consecutive ones) not to move whitespaces at the
start of the next line, which, while they will be removed later on,
can lead to incorrect reflow width and even fully empty lines.
Prefer leave trailing spaces then, which is less of a problem.
2016-01-04 22:21:19 +01:00
Colomban Wendling
46ed77bf19 reflow: Fix infinite loop on some input with many consecutive spaces
Avoid triggering auto-indentation with consecutive whitespaces when
reflowing, as it can lead to infinite loop if auto-indent leads to
inserting full lines.

Fixes #848.
2016-01-04 21:58:42 +01:00
Ben Wiederhake
2df9f83bf2 Typos overlooked by codespell 2016-01-03 18:44:00 +01:00
Ben Wiederhake
29a6b9c003 Fix typos
All of these typos were found by codespell, so credits go the
the authors of this incredibly useful tool.

I manually confirmed and adapted all changes, which includes
reflowing over-long lines or filling up with spaces for alignment.

Some of these typos may need forwarding to their original authors.
codespell reported a lot words where I am unsure; I have not
included those corrections.
2016-01-03 18:33:25 +01:00
Ben Wiederhake
9941c2d044 Fix obvious typo 2016-01-03 18:01:10 +01:00
Thomas Martitz
ae0fac33f4 doxygen: undo export of some items from commit 302b40e
Some types were undocumented on purpose and shall not be exported just yet.
2015-12-21 20:07:56 +01:00
Devyn Collier Johnson
d1fcd9f226 Add *.asm51 and *.a51 extensions for 8051 assembly
The *.a51 extension is also used for Adobe Authorware files, but we are
unlikely to ever support those.

Closes #739
2015-12-19 17:31:06 -08:00
Colomban Wendling
8d643d6688 Fix missing progress bar during build runs
Restore progress bar pulsation while a build is running, as it was lost
by accident in 690cb922be902f023881d455ae0c0a87d1c62170.

Closes #765.
2015-12-19 17:08:01 -08:00
Matthew Brush
45f531cd4b Fix known memory leak in win32_show_folder_dialog() 2015-12-19 16:56:45 -08:00
Colomban Wendling
9365110c4c CUDA: Use C++ ctags parser
Closes #830.
2015-12-18 21:31:38 +01:00
Thomas Martitz
302b40e977 doxygen: various doxygen-related fixes in preparation for gtkdoc generation
Major changes are:

- Some types were accidentally documented, even though they couldn't be
accessed by any exported API functions. Those are removed (especially
from encodings.h).

- Some types were not documented where they should. Documentation is
added for them. Members are not necessarily documented separately if names
are self-explanatory.

- @a XXX refers to parameters of the function, it's inappropriate for
highlighting NULL (change to @c)

- As per consensus, build_info is removed from GeanyData (replaced by
pointer to avoid ABI break; added grep-able abi-todo tag so it doesn't get
forgotten)
2015-12-17 09:52:52 +01:00
Thomas Martitz
6098f55032 encodings: move private stuff into private header
encodings.h had a pretty large GEANY_PRIVATE part so it's worthwhile to
separate that into its own header (as per HACKING). What's left is used by the
plugin API.
2015-12-17 09:52:49 +01:00