Commit Graph

2169 Commits

Author SHA1 Message Date
95c0909290 Add warning checks in GDScript analyzer
Reenable checking those when validating code.
2020-07-20 11:38:40 -03:00
9a76ab8b6a Add new GDScript type checker 2020-07-20 11:38:40 -03:00
17cd6347ba Add better local variable detection in GDScript parser
Also store Variant operator to avoid needing to do it repeatedly in
later compiling stages.
2020-07-20 11:38:39 -03:00
7adb0d77cc Add GDScript cache singleton 2020-07-20 11:38:39 -03:00
886732ac2b Add support for properties 2020-07-20 11:38:39 -03:00
34c28eb2b8 Fix comments in beginning of file
Also improve error for unknown characters.
2020-07-20 11:38:39 -03:00
5d6e853806 New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
8dcc39ec91 Include gdscript warning name in LSP message.
My initial attempt changed this in the gdscript code, which resulted in
a duplicate warning name in the builtin editor. We should just append
the warning name in the LSP instead.

This uses parens to match what is shown in the builtin editor.
2020-07-14 07:11:16 -04:00
d92fa3b547 Revert "Include gdscript warning name in the warning message."
This reverts commit de3ad3b30e.
2020-07-14 06:43:58 -04:00
bc4cee4458 Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit
- Removed enable syntax highlighting from text edit
- Added line_edited_from signal to text_edit
- Renamed get/set_syntax_highlighting to get/set_syntax_highlighter
- Added EditorSyntaxHighligher
2020-07-11 17:09:58 +01:00
156daddaaf Expose Syntax highlighter for editor plugins 2020-07-11 15:40:00 +01:00
2f1080be9b Convert syntax highlighters into a resource 2020-07-11 15:26:58 +01:00
91ce8d5fff remove invalid codeLensProvider value from lsp
codeLensProvider was false, it may not be a boolean like some of the other providers can, only optionally present.
2020-07-11 00:57:32 -06:00
26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
e9c8bf5e1b Fix GDScriptEditorTranslationParserPlugin instance leak 2020-07-06 22:40:52 +02:00
a535b9160d Merge pull request #40155 from rcorre/warning-names
Include gdscript warning name in the warning message.
2020-07-06 16:49:54 +02:00
80582d1f82 Merge pull request #40116 from ThakeeNathees/editor-crash-on-super-constructor
Fix: editor crash on super constructor called
2020-07-06 16:45:37 +02:00
de3ad3b30e Include gdscript warning name in the warning message.
Occasionally you want to ignore a warning with a `warning-ignore`
comment, and you have to go into the settings to look up what the
actual name of the warning is. This patch appends the warning name to
the end of the warning so you know what string to use to ignore it,
similar to other linters like pylint.

For example

```
"The signal 'blah' is declared but never emitted.";
```

is now

```
"The signal 'blah' is declared but never emitted. (UNUSED_SIGNAL)";
```
2020-07-06 07:22:34 -04:00
cae6f0bda2 Change translation parser plugin API to parse_file() 2020-07-05 12:14:56 +02:00
023b3f2786 Fix: editor crash on super constructor called
Fix: #39909
2020-07-04 16:06:07 +05:30
efb4609425 Add translation parser plugin support 2020-07-02 14:47:35 +02:00
a8a2769bb6 Merge pull request #38713 from aaronfranke/string-64bit
Make all String integer conversion methods be 64-bit
2020-07-01 16:01:05 +02:00
13298ed873 Improve the preload and load descriptions 2020-06-28 20:51:46 +02:00
d341181f30 Merge pull request #38067 from ThakeeNathees/elif-error-line-fixed
GDScript debugger incorrect error line fixed
2020-06-17 19:17:44 +02:00
9325671faa GDScript debugger incorrect error line fixed
if the first line of an else or an elif throws a runtime error the
debugger shows incorrect line number.
2020-06-17 21:24:01 +05:30
697897cc61 Merge pull request #39275 from ThakeeNathees/shadowed-warning-for-loop-counter
Added shadowed var warning for `for` loop counter
2020-06-16 15:51:31 +02:00
6cefb8d368 Merge pull request #39314 from ThakeeNathees/debugger-incorrect-line-fix
GDScript debugger stepping to incorrect line fix
2020-06-16 09:26:49 +02:00
df0779acfd Merge pull request #39315 from ThakeeNathees/ctrl-click-fix-for-subclasses
Fix: Ctrl + Click not working for subclasses
2020-06-16 09:26:15 +02:00
786f4ada35 GDScript LSP: Fix wrong error checks added in #39385
Reverts `latest_client_id` back to 0, as I misunderstood how the client
IDs are assigned and, without further testing and debugging, I can't
say if this was a bug or a valid default value.
Similarly, a `latest_client_id` of -1 is no longer raising an error.

Fixes #39548.
2020-06-15 09:51:56 +02:00
e34f33711b GDScript LSP: Fix crash in notify_client
`latest_client_id` now defaults to `-1` (invalid ID) instead of `0`.

Also fix typo in notification `gdscrip_client/changeWorkspace`,
and fix argument names in method binds.

Fixes #39375.
2020-06-08 11:01:45 +02:00
36f6103026 Merge pull request #39301 from Calinou/fix-argument-parameter-confusion
Tweak the GDScript error message about passed argument type mismatch
2020-06-05 11:33:53 +02:00
150ba031de Merge pull request #39276 from ThakeeNathees/predefined-check-for-loop-counter
Added predefined var check for `for` loop counter
2020-06-05 11:01:55 +02:00
95b0a00d2c Fix: Ctrl + Click not working for subclasses 2020-06-05 12:25:07 +05:30
fc89c5c76d Debugger stepping to incorrect line fix
Fix: #39296
2020-06-05 12:15:37 +05:30
30053de182 Tweak the GDScript error message about passed argument type mismatch
This makes it less confusing.

This closes https://github.com/godotengine/godot-proposals/issues/670.
2020-06-04 22:31:37 +02:00
e153772de2 predefined var check for for loop counter 2020-06-04 10:37:22 +05:30
54835a5302 shodowed var warning for for loop counter
Fix: #39268
2020-06-04 10:28:09 +05:30
25c978730b Rename String bin_to_int64 to bin_to_int
And also change String static to_int(const char *) to return int64_t
2020-06-03 00:04:15 -04:00
e5ae89775a Remove 32-bit String hex_to_int method 2020-06-03 00:03:34 -04:00
bb8aa107fd Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
0f1da72492 Actually set GDScript static reference 2020-05-29 11:01:48 -03:00
ab460e7a6f Merge pull request #39074 from vnen/gdscript-assert-message
Fix assert message when no custom message is set
2020-05-27 08:23:17 +02:00
f29a2e2606 GDScript: Fix assert message when no custom message is set 2020-05-26 20:40:59 -03:00
bfac9b3538 Merge pull request #39015 from ThakeeNathees/dict-key-autocomplete-regression-fix
regression: dictionary key no autocomplete fix
2020-05-25 15:58:08 +02:00
13c372b522 regression: dictionary key no autocomplete fix
Fix: #38998
2020-05-24 16:52:44 +05:30
78e223569b Merge pull request #33689 from jbuck3/signal-error
Trigger an error when trying to define a preexisting signal in GDScript
2020-05-21 11:01:23 +02:00
af366c7adf Merge pull request #35900 from yamgent/unreachable
Fix false positive "Unreachable code" warning for loops
2020-05-21 10:59:59 +02:00
1f0548efd4 Fix too eager GDScriptFunctionState stack cleanup 2020-05-19 16:41:14 +02:00
7b1423a61e gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops,
their body may not even execute once. For example:

    func a():
        var arr = []
        for i in arr:
            return i
        # can be reached, but analysis says cannot
        return -1

    func b():
        var should_loop = false
        while should_loop:
           return 1
        # can be reached, but analysis says cannot
        return 0

The parser will complain that the statements after the comment cannot
be reached, but it is clearly possible for our scenario. This is
because the parser falsely assumes that the loop body will always
execute at least once.

Fix the code to remove this assumption for both of those loops.
2020-05-16 20:02:55 +08:00
6815bf42b3 Fix incorrect capabilities notification in LSP
(cherry picked from commit 2173d041af)
2020-05-15 23:55:49 +02:00