feat(codeintel): Add scip-ctags support for Magik#63504
Conversation
…-ctags-or-universal-ctags
docker-images/syntax-highlighter/crates/syntax-analysis/src/languages.rs
Show resolved
Hide resolved
...crates/syntax-analysis/src/snapshots/syntax_analysis__test__tags_snapshot_globals.magik.snap
Outdated
Show resolved
Hide resolved
From what I can tell at a glance Marking a global definition as
From a quick read I'd say it's closest to a class.
Mixins are meta-classes. The closest mainstream analogy might be a "decorator"... Looking at the list of capture kinds I don't see anything that matches better than class. |
docker-images/syntax-highlighter/crates/syntax-analysis/src/lib.rs
Outdated
Show resolved
Hide resolved
...crates/syntax-analysis/src/snapshots/syntax_analysis__test__tags_snapshot_globals.magik.snap
Show resolved
Hide resolved
docker-images/syntax-highlighter/crates/syntax-analysis/testdata/globals.magik
Show resolved
Hide resolved
| _method line_parser.new() | ||
| _return _clone.init() | ||
| _endmethod |
There was a problem hiding this comment.
@sebastiaanspeck is it common/possible to have non-trivial tree structures of declarations in Magik? I.e.
- A
def_slotted_exemplarordef_mixininside a method body (if this is possible, is it accessible outside the method) - Another method definition inside a method body.
- Method bodies inside a slotted exemplar or mixin definition (similar to other languages like Java or Ruby)
There was a problem hiding this comment.
@sebastiaanspeck Ping on this if you can help us.
There was a problem hiding this comment.
Ah sorry, missed this comment completely.
def_slotted_exemplaranddef_mixinare invokable proc's. You could definitely call those inside a method body. The class (or in Magik exemplar) will be available to the package it is declared in.
Question 2:
_method example.method_a
_method example.method_b
>> "Hello World"
_endmethod
_endmethod
$
This will not work.
Question 3:
def_slotted_examplar(:example, {},
_method example.method_a
>> "Hello World"
_endmethod)
$
def_slotted_examplar(:example, {})
$
_method example.method_a
>> "Hello World"
_endmethod
$
If you are talking about the second snippet, that is absolutely possible:
docker-images/syntax-highlighter/crates/syntax-analysis/queries/magik/scip-tags.scm
Show resolved
Hide resolved
…-ctags-or-universal-ctags
| _block | ||
| _local some_local << 1 | ||
| _constant some_local_constant << 1 | ||
| _global some_global1, some_global2 |
There was a problem hiding this comment.
@sebastiaanspeck Does defining a global inside of a block or a method create a new top-level global, or does it only let you refer to an existing top-level global?
There was a problem hiding this comment.
If the referring global variable already exists, it will access that one.
If the name does not include a package qualifier (@sw: or sw:) and there is no matching top level global, then the value of !global_auto_declare?! determines the subsequent behaviour:
- if true, the Magik compiler creates a global variable with value unset
- if maybe, the Magik compiler interactively queries the user if you want to declare a global variable.
- if false, the Magik compiler raises an error
…-ctags-or-universal-ctags
…-ctags-or-universal-ctags
Adds scip-ctags support for Magik. Some of the interesting pieces are that Magik uses a more prototype style of classes (called examplars) and tried to map those properly as classes. In addition, it has Mixins defined in a similar way and I also mapped those are classes as well
Test plan
Changelog