@codua/codeoutline-win32-x64 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/xnet.exe +0 -0
- package/build-info.json +1 -1
- package/editors/codeoutline.vsix +0 -0
- package/package.json +1 -1
- package/scripts/codeoutline/analysis/graph.lua +2 -0
- package/scripts/codeoutline/analysis/lua/lua_bindings.lua +165 -22
- package/scripts/codeoutline/analysis/receivers.lua +164 -11
- package/scripts/codeoutline/lang/lua.lua +3 -2
- package/scripts/codeoutline/query/completion.lua +11 -1
- package/scripts/codeoutline/query/definition_candidates.lua +74 -58
- package/scripts/codeoutline/query/navigation.lua +45 -22
- package/scripts/codeoutline/update_sequence.lua +1 -1
- package/scripts/codeoutline/version.lua +1 -1
package/bin/xnet.exe
CHANGED
|
Binary file
|
package/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"updateSequence":26,"target":"win32-x64","version":"0.3.7","runtimeCommit":"be18042e9091379bf45624771a4e8819d2709f84","runtimeBuild":"4f732f99896571583bf36c62f9e00127fdffe245f43bacd27ee38e08d9cd1298","lua":"LuaJIT 2.1.1774896198","sourceCommit":"a68de1768661bd1b9b30f9b5e0168cb0fbcd9769","sourceDirty":false,"releaseReady":true,"note":"Release build from a clean checkout","sha256":{"scripts/codeoutline/analysis/rust/rust_packages.lua":"c6886a77017bf039499d93027b28bd354599875a5d3705f622ea3366512432e8","scripts/codeoutline/analysis/automatic_events.lua":"2d81c3e943964680e13b6005b823f05637c31891f3759fec7074e14d20b7f150","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","scripts/codeoutline/analysis/rust/rust_resolution.lua":"2b9ec789243cda63107a721e8d907faa3d3d5c18f21a69b634db4deac9e586ee","scripts/codeoutline/analysis/js/js_evidence.lua":"523913dcadb37ec433b31103c12218c383001851b7cf965cf4505065917d8afe","scripts/codeoutline/lang/csharp.lua":"93762ccefd326fb04fcc5c5dd73821241216e9374de2abbe9e4f53fe5af1c160","scripts/codeoutline/analysis/shared_events.lua":"88fb64d66e6d41da3beeaeff86f6357b5a8ceae16003ba194aaa01171e4874f1","scripts/codeoutline/runtime/index_worker.lua":"0bfbf38fe9cb6e8a92b958028c6df9970575f881330dd4568a621463d20497b8","scripts/codeoutline/analysis/js/js_resolution.lua":"427a4656216878487e9c11a02faa4f6c4240fb00b126ec298479a45c12f3ecce","scripts/codeoutline/lang/go.lua":"027afb44a9c3a92aa74b9af230d8571963183697529fd41fe915ffa831f3e8da","scripts/codeoutline/analysis/static_dispatch.lua":"9940f4c4317e8f5345a9f39178fac639278bc186265a72369f1be808bdeebd29","scripts/codeoutline/runtime/parse_worker.lua":"4cb620924fbe43d0f9a411c689060575220c0b2947d09fba266fe552ad003cfe","scripts/codeoutline/analysis/cpp/cpp_bindings.lua":"06adeb3b4a56d97555b6e4bd775de8dd1c9d2331474b670d53188d4fbe4b3b0c","scripts/codeoutline/analysis/js/js_workspace.lua":"230df95605e0ce47a940f425611d426eaa3d4de262736e3dfe3bd1f15db956b4","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/analysis/type_bases.lua":"470fdcfffc3ded8bd3c9608db6128539757c91692bc714173dbb1bcdf8344e36","scripts/codeoutline/protocol/lsp_trace.lua":"41e6e67866eb6c862cf11337a637a94505f62a29533a9dbd6226d3b801444597","codeoutline.cmd":"52ee46a6010ff1161369e50df76e96beed2d6152f8c8e5095f73bc0b60a7629b","scripts/codeoutline/analysis/js/ts_implementations.lua":"2e92afd3b76a3dab73b99d7900dd357d37b9749a11c5bc11946e0d62d39e7be8","editors/zed/extension.wasm":"22655024875868084fc43c92abdccfeb03773d40bf03d5ce18068384c3122fd9","scripts/codeoutline/service.lua":"795797bf7d3b329e67fff5b3d8bd9ab2681dfb2472f7d9a8236756bea67c0c56","scripts/codeoutline/analysis/type_uses.lua":"eb1ee73f0a3cb67ef3b92ed1a8b7222fbc26137f743e466338e180b416ea12cb","editors/zed/extension.toml":"2c5e28806d71e03b0c421d35b8a9aa9e1d428038417aebd7bdf3c871b22d93f4","editors/codeoutline.vsix":"4c5552495a7025c28d51cd870f28cc641dc3e7124d3cb9ba3c28cc9081cb7c7b","bin/xnet.exe":"b3e030912ad8180e66c6801c4b2c986f6325f5ac5f07a5f012f72da8b6332486","THIRD_PARTY.md":"a0d596a8600c5244b27c1426a81b4ec7046d213d733ec6b4287a4b1e8db501b5","DISTRIBUTION.md":"7f1b6d02bd3fa71a7d02cbd57bebd82fbd930d96c1cb32a5f15764466c88ef12","scripts/codeoutline/cli.lua":"28b058bbb3c86d9e6a7603c52ef62eacc8978af6c2201e61bfb8100bc79be4b2","README.zh-CN.md":"d65838da7d26d7f35df6d60c3c24b2142219131197b23e237128c83e2602250c","README.md":"291594269b54eb0690bad6c05b06585cd28989e9ddde9b3cc5422a6a2a944fb3","scripts/codeoutline/analysis/cpp/cpp_macros.lua":"fa79cd9ea652be2a921f930d0ec21dcfc1d61b15e0ea2cd22ad4141eeb4e9552","scripts/codeoutline/analysis/lua/foreign_lua.lua":"c217da78314febeff5d20c9d7e9f68e25089d1e76f4350405d83af494deac3dc","scripts/codeoutline/shared/control.lua":"b67a2e382e021f0793ef313aa4e71faab76f6cb77ca127f499d01ae96f36a8db","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/codeoutline/command.lua":"0b16dc8b960569bc7fc3d6c363f41d0672da8271de05ca0728ae5c1deb471fc6","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/analysis/cpp/cpp_receivers.lua":"4f9bea5325d0ccd3ddfe5117bf8891408d41988bdc94d6a388363624b64df0f3","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/codeoutline/lang/js.lua":"ff326c9ef41deb5ec7f961a556350b69c4b601a176d696114a2096d5118c2379","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/analysis/cpp/cpp_types.lua":"18e68635a30f86a8975cc556839ed2be961685353dec290749fd169d3049cf16","scripts/codeoutline/lang/kotlin.lua":"8b5dabbbede62bf0a1376414f7424e6dd3a248739cc015c2364d143901230d86","scripts/codeoutline/analysis/lua/lua_callback_loops.lua":"2b28f338ebc23c8a6543fad61e932ceaee409512b69a71711d385fcc0bdafd4c","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","codeoutline":"1909247ba17be9d0fe14d689ea7c1c955013b5b79f05336e2161b6f161c4c394","scripts/codeoutline/indexing/cache_repairs.lua":"7e31a6118c3e991382ae2751a8b1d4913bcbf4e24d35f56253f46e156e8420a5","scripts/codeoutline/lang/lua.lua":"73f2f83ca086fb64e7b26b86d0a3ba4a1a2028a68df52e3cf9dce25cd73929a9","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/codeoutline/analysis/lua/lua_literal.lua":"5fdd90a872988622337410c7e516d41b789ce4326c4aa6dddcd61998fe5aef90","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/analysis/csharp/csharp_bindings.lua":"722c8fb2b133bbe09179293b068967fe70e7a2e8942380068a04a97b1283a43d","scripts/codeoutline/lang/python.lua":"a0b2b64fe42e585ec922304d3b8ecd6c679a97fecfe1bc56014f1556558c9387","scripts/codeoutline/indexing/cpp_fragments.lua":"6be4c3f89c234b6982235981d9f128875790acd5d22f80fe11290bb99af903a3","scripts/codeoutline/query/completion.lua":"688d1ca54bbbd5c7dad40286251b2ad1c404c66f5bc61da1e5dea065a615ffd8","scripts/codeoutline/analysis/ordinary_bindings.lua":"ec9f3609650f2ec05dd429e178118a4dded9b6c40cfecdd5efcdeb5e0bb2ad94","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/codeoutline/lang/rust.lua":"45d0a9c535d674b31990ba1052f97b2da2a98565a68294937429f443ac1c8da5","scripts/codeoutline/analysis/dispatch_aliases.lua":"05f3b06d7d890089b8e18a2e849df9a5ec433bce5312a22d80b7be417e614373","scripts/codeoutline/query/coverage.lua":"3a4a0e5f5ea8b7ea4a0be62c7c1a202153cf0c5c3423f78b100aecbb39513d5e","scripts/codeoutline/indexing/index.lua":"459a02dd0c436df968703b74b9fb4624b6fdb4adfffc2383c7abbdb683ef6160","scripts/xupgate/http_client.lua":"e910132b82779969926f959fc876da4aa4807559f91d1d01d32b263f1784e01d","scripts/codeoutline/main.lua":"9f884e383721888af68fd41f3dfdd816e65e4d569346664e390ee086a4b55fa3","scripts/xupgate/common.lua":"e449f64c92e4ef46d0c9f4c815aacb38866392cbc3502544d3a1985f9dc4f978","scripts/codeoutline/analysis/foreign.lua":"4c8fdbe398f2b43be861ce0e4915916956c1fb2af6c10c5c04a9654e8aac2bf2","scripts/xupgate/client.lua":"88d8ccdd54282257d233af714fad22abc7af4b9ad65882f58330cc8814461985","scripts/codeoutline/indexing/parse_pool.lua":"5a35dad6a6a44a2dccd793a694e65e5a2bdb621911d56bdb32375ce8295889d8","scripts/codeoutline/version.lua":"d664c88a2d0632fc98b733a6e66e79b049e37b581f5ce0def27439a2df8d8210","scripts/codeoutline/update_sequence.lua":"3e941d94d7779e4d6c362866828f9c2d823683068cd31b502d0e4b0b10aacf6f","scripts/codeoutline/query/documents.lua":"1ed27cb6f805c1ff9acbc070f16e582b71c4a330c5539fb3d7b8ed4150c82bdf","scripts/codeoutline/analysis/function_values.lua":"d10bc4a2a82a90a611daf3c2bb26c41da43543f7831711bd4b0c311ad5569d80","scripts/codeoutline/updater.lua":"267c4b6e9704fce710f44d1bfceac69c1857e34e064d8444d7890f0e10d921c7","scripts/codeoutline/shared/text.lua":"56ee63c7b4cc63fe12d8ecd5b99410281463cdba8ca112f484e402ca6dfc5b90","scripts/codeoutline/shared/rules.lua":"b01402863062435a6d31a4a5a90208319876fdb444a76c75fd0c45ea8ee6fee5","scripts/codeoutline/parsing/common.lua":"6c883bb69827fd9e88e35f7ecc380f43e3a839fbea127e46ad6923c44beeb590","scripts/codeoutline/shared/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/codeoutline/runtime/update_worker.lua":"9557e5207e440fccf15e8255b3fb1c8933ad33d1f352c19987fb825f7db45706","scripts/codeoutline/runtime/idle_gc.lua":"2025b037b593b5e19714b6e283c8a0490146e591de795988a543a161277714f1","scripts/codeoutline/lang/cpp.lua":"e13eaf1882cddb20a7a651d13136e06ca42c482cf7ac53de38bf82fdda786727","scripts/codeoutline/install/agent_config.lua":"041e1736f7be060b9eac9f3ced0b20f50854d94af2cddfa22c5d3868f3fc1681","scripts/codeoutline/parsing/language_detect.lua":"4c9fd0fcd270cfd123e9e9d0bcc2f3635cd19a8784098a03cee6bce5ac593e8c","scripts/codeoutline/analysis/cpp/cpp_includes.lua":"7a2de73f528a608eb89aea0f5fe8d18b3ef51d6e9966106af0ecd41f03304d07","scripts/codeoutline/analysis/go/go_frameworks.lua":"2f2a692a6dbda384abf32af0750bb40e99f1bc3e83f039215f0eaf750cf77f65","scripts/codeoutline/protocol/lsp.lua":"f236c0407dc8b479c883cd526a19dca61efd999926e70d564d299c3972074224","scripts/codeoutline/query/navigation.lua":"e550b2a630cb61a6e5123b40930cadde0952ad3b2adba5fadfbb4146c209defa","scripts/codeoutline/parsing/parse.lua":"81dacf0f07440f1a7516732c39251d0d7f07cef77f7d8f9f25bdacd96c7919a0","scripts/codeoutline/analysis/python/python_bindings.lua":"ec4217f77345282a5522696c1b53e3886fb0e9a45736c10613fcb0fd4f016160","scripts/codeoutline/query/query_report.lua":"f53c24c48f3f94dd17c7f0be5501865aff0af73d926f27e03d9849c168996462","scripts/codeoutline/query/explore.lua":"04c670153afe4a2052a06ff9f21bec197ac82faaba53a7bd3335c93d31469544","scripts/codeoutline/analysis/go/go_methods.lua":"71832a6b8941a6b6f9155c59cec2da7c33108a132608cdaa2cd85076c4e241cf","scripts/codeoutline/parsing/xscan.lua":"bd95a1b0b7022d029a41aab615897502478b5834612505e8d299343cb5ca8ef9","scripts/codeoutline/query/on_demand.lua":"7faf5e4d5f21ca73903903703178d9d983c98d1ddb30d9ca5656bbae676e1f1a","scripts/codeoutline/query/external_headers.lua":"9b8d8a87a67839d4da1d5eced619d7c54431dbff32b07d505ea54350bdc2de3b","scripts/codeoutline/analysis/receivers.lua":"4729e09ecac8c3d24367a9db531e58be42c73547373118987a8b83ef9c32ff17","scripts/codeoutline/query/query_filters.lua":"dfaac210f8ebf53d0e4515866b0128a77ff77cb0c8d7d558b71a4eaf9f2b32ef","scripts/codeoutline/analysis/go/go_modules.lua":"432dc66435fe93fbc2a7d1aa4212ae03ad5454effd18ffb3e06c2eca6a169aab","scripts/codeoutline/query/definition_candidates.lua":"0e9fe37df6e897b7203ebbe3214ee0f92410a135e0d4decdfae1842702ab75a0","scripts/codeoutline/query/callers.lua":"b1870f2d08c2274ce743d513560ce9329e16236399e065027685dbf8694c82ab","scripts/codeoutline/query/affected.lua":"7fe6ae466b314957f39ceb8fcc1f0a5339d523c86f99ce5735599a2477865b72","scripts/codeoutline/analysis/resolution.lua":"ec137a38abfdcb7f366861a123480a3b3125a76acf7399a784f8fb207e833d0b","scripts/codeoutline/install/install_prompt.lua":"588c90cd2955756b13a96e1f0d17145a51eda239c9cf179d5eac195532ee9f49","scripts/codeoutline/analysis/graph.lua":"e434dac63c5291f76faca97ee8b8e94f9ac5a9b8c529aeab56ca9de9a9d4bfd1","scripts/codeoutline/protocol/http.lua":"bd558939df95e4a908551f43ca5bf0eb68d7a16b8eb20b1b4076a5ece20956b7","scripts/codeoutline/protocol/mcp.lua":"1e65df410d6cede3cc0fb227ea406a5e7e178d425b5ed861f73d8b748fbdbae7","scripts/codeoutline/query/search_ranking.lua":"153987a2915c48516b8dca10121b8efa2b116af8cf82200243e45f1fd5feffb4","scripts/codeoutline/lang/c.lua":"f341d250a09a937d8548657991bdeac0aec8de26b7d056292709126ee999c6f1","scripts/codeoutline/analysis/lua/lua_bindings.lua":"3639c8336b4f4f12be6a34842fb0a1b128d32d3125099a7dbd182a8a9ce0c364","scripts/codeoutline/analysis/implementations.lua":"ffcd7288eae967c5628c85b8e55d93c826b30524956212dccca7d150ac7ac3be","scripts/codeoutline/install/editor_install.lua":"a69f5e123f7fbdb58fe2da691c744c0668a11ccd88f17a98167038c80a5d4cff","scripts/codeoutline/query/type_hierarchy.lua":"e5ccfa85ac63c636f50d33310274559624c08954e1f77a197ff941d799669b37","scripts/codeoutline/analysis/cpp/cpp_implementations.lua":"87d637812626672f44226e245f94d675e209a83e4cd2d6b2a320ed9d60a6a3d0","scripts/codeoutline/analysis/rust/cargo_toml.lua":"78f4f8bcf14f8db80bdac9fc2568988372d3cca222f82b34708f5330c00c8771","scripts/codeoutline/install/daemon.lua":"06863991135cc9a85f07bca8310296f0df9e415b3e2de97ae006393e777b009b","scripts/codeoutline/analysis/indirect.lua":"38e15056251400f840604af29fb3ddacac7915d2cf1c2bf7870d481497cc8831","scripts/codeoutline/query/type_references.lua":"9119a2c55b2ae825190ac50d97d6a4cacacd33a707cd1e98b532c4a7d02e4a0c","scripts/codeoutline/install/agent_install.lua":"32409b49dd1e8436169f334587b4994c9d6868ed3ff5c4eaed09b4b3b8ca12c4","scripts/codeoutline/lang/java.lua":"3c6b2d844202cbe988644e94090be76e7f8a2a906f4412aefcbd06e9fb56a01b"}}
|
|
1
|
+
{"runtimeCommit":"be18042e9091379bf45624771a4e8819d2709f84","runtimeBuild":"4f732f99896571583bf36c62f9e00127fdffe245f43bacd27ee38e08d9cd1298","lua":"LuaJIT 2.1.1774896198","sourceCommit":"480dc6748fa8800982b96b35a1a3f4ce8d41173b","sourceDirty":false,"releaseReady":true,"note":"Release build from a clean checkout","sha256":{"bin/xnet.exe":"5184cdcd5f125c68b17f42297f9c288738433ff2013703da2872628a5be3636c","scripts/codeoutline/analysis/csharp/csharp_bindings.lua":"722c8fb2b133bbe09179293b068967fe70e7a2e8942380068a04a97b1283a43d","scripts/codeoutline/analysis/python/python_bindings.lua":"ec4217f77345282a5522696c1b53e3886fb0e9a45736c10613fcb0fd4f016160","scripts/codeoutline/query/explore.lua":"04c670153afe4a2052a06ff9f21bec197ac82faaba53a7bd3335c93d31469544","scripts/codeoutline/install/daemon.lua":"06863991135cc9a85f07bca8310296f0df9e415b3e2de97ae006393e777b009b","scripts/codeoutline/analysis/dispatch_aliases.lua":"05f3b06d7d890089b8e18a2e849df9a5ec433bce5312a22d80b7be417e614373","scripts/codeoutline/analysis/receivers.lua":"3b2d09cab61dac5549e96fb007d0538661391c1d4f25573d1872221d8c7b2d3c","editors/zed/extension.wasm":"22655024875868084fc43c92abdccfeb03773d40bf03d5ce18068384c3122fd9","scripts/codeoutline/install/editor_install.lua":"a69f5e123f7fbdb58fe2da691c744c0668a11ccd88f17a98167038c80a5d4cff","scripts/codeoutline/query/navigation.lua":"48175a1fd5cb6739693b9594370ccdf6ff01d54f2db521b6950e055cd855147f","scripts/codeoutline/analysis/foreign.lua":"4c8fdbe398f2b43be861ce0e4915916956c1fb2af6c10c5c04a9654e8aac2bf2","scripts/codeoutline/analysis/resolution.lua":"ec137a38abfdcb7f366861a123480a3b3125a76acf7399a784f8fb207e833d0b","scripts/codeoutline/install/install_prompt.lua":"588c90cd2955756b13a96e1f0d17145a51eda239c9cf179d5eac195532ee9f49","scripts/codeoutline/query/on_demand.lua":"7faf5e4d5f21ca73903903703178d9d983c98d1ddb30d9ca5656bbae676e1f1a","scripts/xupgate/common.lua":"e449f64c92e4ef46d0c9f4c815aacb38866392cbc3502544d3a1985f9dc4f978","scripts/codeoutline/analysis/function_values.lua":"d10bc4a2a82a90a611daf3c2bb26c41da43543f7831711bd4b0c311ad5569d80","scripts/codeoutline/lang/cpp.lua":"e13eaf1882cddb20a7a651d13136e06ca42c482cf7ac53de38bf82fdda786727","scripts/codeoutline/query/query_filters.lua":"dfaac210f8ebf53d0e4515866b0128a77ff77cb0c8d7d558b71a4eaf9f2b32ef","scripts/xupgate/http_client.lua":"e910132b82779969926f959fc876da4aa4807559f91d1d01d32b263f1784e01d","scripts/codeoutline/lang/csharp.lua":"93762ccefd326fb04fcc5c5dd73821241216e9374de2abbe9e4f53fe5af1c160","scripts/codeoutline/analysis/rust/cargo_toml.lua":"78f4f8bcf14f8db80bdac9fc2568988372d3cca222f82b34708f5330c00c8771","scripts/codeoutline/query/query_report.lua":"f53c24c48f3f94dd17c7f0be5501865aff0af73d926f27e03d9849c168996462","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/go.lua":"027afb44a9c3a92aa74b9af230d8571963183697529fd41fe915ffa831f3e8da","scripts/codeoutline/analysis/go/go_frameworks.lua":"2f2a692a6dbda384abf32af0750bb40e99f1bc3e83f039215f0eaf750cf77f65","scripts/codeoutline/query/search_ranking.lua":"153987a2915c48516b8dca10121b8efa2b116af8cf82200243e45f1fd5feffb4","scripts/codeoutline/analysis/rust/rust_packages.lua":"c6886a77017bf039499d93027b28bd354599875a5d3705f622ea3366512432e8","scripts/codeoutline/lang/java.lua":"3c6b2d844202cbe988644e94090be76e7f8a2a906f4412aefcbd06e9fb56a01b","scripts/codeoutline/query/type_hierarchy.lua":"e5ccfa85ac63c636f50d33310274559624c08954e1f77a197ff941d799669b37","scripts/codeoutline/analysis/go/go_methods.lua":"71832a6b8941a6b6f9155c59cec2da7c33108a132608cdaa2cd85076c4e241cf","scripts/codeoutline/analysis/rust/rust_resolution.lua":"2b9ec789243cda63107a721e8d907faa3d3d5c18f21a69b634db4deac9e586ee","scripts/codeoutline/lang/js.lua":"ff326c9ef41deb5ec7f961a556350b69c4b601a176d696114a2096d5118c2379","codeoutline":"1909247ba17be9d0fe14d689ea7c1c955013b5b79f05336e2161b6f161c4c394","scripts/codeoutline/query/type_references.lua":"9119a2c55b2ae825190ac50d97d6a4cacacd33a707cd1e98b532c4a7d02e4a0c","codeoutline.cmd":"52ee46a6010ff1161369e50df76e96beed2d6152f8c8e5095f73bc0b60a7629b","scripts/codeoutline/analysis/go/go_modules.lua":"432dc66435fe93fbc2a7d1aa4212ae03ad5454effd18ffb3e06c2eca6a169aab","scripts/codeoutline/lang/kotlin.lua":"8b5dabbbede62bf0a1376414f7424e6dd3a248739cc015c2364d143901230d86","editors/zed/extension.toml":"2c5e28806d71e03b0c421d35b8a9aa9e1d428038417aebd7bdf3c871b22d93f4","scripts/codeoutline/analysis/graph.lua":"41f80f733f289f3ebea57e3442a97c55cdcb1384db11f1901853a13af75db0e5","THIRD_PARTY.md":"a0d596a8600c5244b27c1426a81b4ec7046d213d733ec6b4287a4b1e8db501b5","DISTRIBUTION.md":"7f1b6d02bd3fa71a7d02cbd57bebd82fbd930d96c1cb32a5f15764466c88ef12","scripts/codeoutline/lang/lua.lua":"813efafda42e27d0bc9b4bdbf1e9e481ec8b834a6127db54e1ed56e61f7d5626","scripts/codeoutline/analysis/static_dispatch.lua":"9940f4c4317e8f5345a9f39178fac639278bc186265a72369f1be808bdeebd29","README.zh-CN.md":"d65838da7d26d7f35df6d60c3c24b2142219131197b23e237128c83e2602250c","README.md":"291594269b54eb0690bad6c05b06585cd28989e9ddde9b3cc5422a6a2a944fb3","scripts/codeoutline/runtime/idle_gc.lua":"2025b037b593b5e19714b6e283c8a0490146e591de795988a543a161277714f1","scripts/codeoutline/lang/python.lua":"a0b2b64fe42e585ec922304d3b8ecd6c679a97fecfe1bc56014f1556558c9387","scripts/codeoutline/analysis/implementations.lua":"ffcd7288eae967c5628c85b8e55d93c826b30524956212dccca7d150ac7ac3be","scripts/codeoutline/analysis/type_bases.lua":"470fdcfffc3ded8bd3c9608db6128539757c91692bc714173dbb1bcdf8344e36","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/lang/rust.lua":"45d0a9c535d674b31990ba1052f97b2da2a98565a68294937429f443ac1c8da5","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/codeoutline/analysis/indirect.lua":"38e15056251400f840604af29fb3ddacac7915d2cf1c2bf7870d481497cc8831","scripts/codeoutline/analysis/type_uses.lua":"eb1ee73f0a3cb67ef3b92ed1a8b7222fbc26137f743e466338e180b416ea12cb","scripts/codeoutline/shared/text.lua":"56ee63c7b4cc63fe12d8ecd5b99410281463cdba8ca112f484e402ca6dfc5b90","scripts/codeoutline/main.lua":"9f884e383721888af68fd41f3dfdd816e65e4d569346664e390ee086a4b55fa3","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/version.lua":"6b55517492d5db9d9a114093ea1e1e0587736fc99d91aa775dc210f6b4a57c30","scripts/codeoutline/analysis/js/js_resolution.lua":"427a4656216878487e9c11a02faa4f6c4240fb00b126ec298479a45c12f3ecce","scripts/codeoutline/runtime/update_worker.lua":"9557e5207e440fccf15e8255b3fb1c8933ad33d1f352c19987fb825f7db45706","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/analysis/js/js_workspace.lua":"230df95605e0ce47a940f425611d426eaa3d4de262736e3dfe3bd1f15db956b4","scripts/codeoutline/command.lua":"0b16dc8b960569bc7fc3d6c363f41d0672da8271de05ca0728ae5c1deb471fc6","scripts/codeoutline/parsing/common.lua":"6c883bb69827fd9e88e35f7ecc380f43e3a839fbea127e46ad6923c44beeb590","scripts/xupgate/client.lua":"88d8ccdd54282257d233af714fad22abc7af4b9ad65882f58330cc8814461985","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/update_sequence.lua":"b6b484a109a9ea291a9f1c48136147c8b7c8f31ea86e74d336ea8c65a8a1e78f","scripts/codeoutline/analysis/js/ts_implementations.lua":"2e92afd3b76a3dab73b99d7900dd357d37b9749a11c5bc11946e0d62d39e7be8","scripts/codeoutline/analysis/automatic_events.lua":"2d81c3e943964680e13b6005b823f05637c31891f3759fec7074e14d20b7f150","scripts/codeoutline/parsing/language_detect.lua":"4c9fd0fcd270cfd123e9e9d0bcc2f3635cd19a8784098a03cee6bce5ac593e8c","scripts/codeoutline/query/callers.lua":"b1870f2d08c2274ce743d513560ce9329e16236399e065027685dbf8694c82ab","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","scripts/codeoutline/lang/c.lua":"f341d250a09a937d8548657991bdeac0aec8de26b7d056292709126ee999c6f1","scripts/codeoutline/shared/control.lua":"b67a2e382e021f0793ef313aa4e71faab76f6cb77ca127f499d01ae96f36a8db","scripts/codeoutline/parsing/parse.lua":"81dacf0f07440f1a7516732c39251d0d7f07cef77f7d8f9f25bdacd96c7919a0","scripts/codeoutline/indexing/cache_repairs.lua":"7e31a6118c3e991382ae2751a8b1d4913bcbf4e24d35f56253f46e156e8420a5","scripts/codeoutline/shared/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/codeoutline/service.lua":"795797bf7d3b329e67fff5b3d8bd9ab2681dfb2472f7d9a8236756bea67c0c56","scripts/codeoutline/runtime/parse_worker.lua":"4cb620924fbe43d0f9a411c689060575220c0b2947d09fba266fe552ad003cfe","scripts/codeoutline/parsing/xscan.lua":"bd95a1b0b7022d029a41aab615897502478b5834612505e8d299343cb5ca8ef9","scripts/codeoutline/analysis/lua/foreign_lua.lua":"c217da78314febeff5d20c9d7e9f68e25089d1e76f4350405d83af494deac3dc","scripts/codeoutline/runtime/index_worker.lua":"0bfbf38fe9cb6e8a92b958028c6df9970575f881330dd4568a621463d20497b8","scripts/codeoutline/indexing/cpp_fragments.lua":"6be4c3f89c234b6982235981d9f128875790acd5d22f80fe11290bb99af903a3","scripts/codeoutline/query/external_headers.lua":"9b8d8a87a67839d4da1d5eced619d7c54431dbff32b07d505ea54350bdc2de3b","scripts/codeoutline/shared/rules.lua":"b01402863062435a6d31a4a5a90208319876fdb444a76c75fd0c45ea8ee6fee5","scripts/codeoutline/analysis/cpp/cpp_bindings.lua":"06adeb3b4a56d97555b6e4bd775de8dd1c9d2331474b670d53188d4fbe4b3b0c","scripts/codeoutline/analysis/shared_events.lua":"88fb64d66e6d41da3beeaeff86f6357b5a8ceae16003ba194aaa01171e4874f1","scripts/codeoutline/analysis/lua/lua_bindings.lua":"8fa65c14a7da95ec2d3ded2484807481123216af05c9ba8c70c929d4d4b0490d","scripts/codeoutline/analysis/js/js_evidence.lua":"523913dcadb37ec433b31103c12218c383001851b7cf965cf4505065917d8afe","scripts/codeoutline/indexing/index.lua":"459a02dd0c436df968703b74b9fb4624b6fdb4adfffc2383c7abbdb683ef6160","scripts/codeoutline/query/affected.lua":"7fe6ae466b314957f39ceb8fcc1f0a5339d523c86f99ce5735599a2477865b72","scripts/codeoutline/protocol/http.lua":"bd558939df95e4a908551f43ca5bf0eb68d7a16b8eb20b1b4076a5ece20956b7","scripts/codeoutline/analysis/cpp/cpp_implementations.lua":"87d637812626672f44226e245f94d675e209a83e4cd2d6b2a320ed9d60a6a3d0","scripts/codeoutline/analysis/lua/lua_callback_loops.lua":"2b28f338ebc23c8a6543fad61e932ceaee409512b69a71711d385fcc0bdafd4c","scripts/codeoutline/updater.lua":"267c4b6e9704fce710f44d1bfceac69c1857e34e064d8444d7890f0e10d921c7","scripts/codeoutline/indexing/parse_pool.lua":"5a35dad6a6a44a2dccd793a694e65e5a2bdb621911d56bdb32375ce8295889d8","scripts/codeoutline/query/completion.lua":"ff2c4102b9a73042f84e823e13ce685aa1d164ee84765db513da2b8ae515e763","scripts/codeoutline/protocol/lsp.lua":"f236c0407dc8b479c883cd526a19dca61efd999926e70d564d299c3972074224","scripts/codeoutline/analysis/cpp/cpp_includes.lua":"7a2de73f528a608eb89aea0f5fe8d18b3ef51d6e9966106af0ecd41f03304d07","scripts/codeoutline/analysis/lua/lua_literal.lua":"5fdd90a872988622337410c7e516d41b789ce4326c4aa6dddcd61998fe5aef90","scripts/codeoutline/protocol/mcp.lua":"1e65df410d6cede3cc0fb227ea406a5e7e178d425b5ed861f73d8b748fbdbae7","scripts/codeoutline/query/coverage.lua":"3a4a0e5f5ea8b7ea4a0be62c7c1a202153cf0c5c3423f78b100aecbb39513d5e","scripts/codeoutline/protocol/lsp_trace.lua":"41e6e67866eb6c862cf11337a637a94505f62a29533a9dbd6226d3b801444597","scripts/codeoutline/analysis/cpp/cpp_macros.lua":"fa79cd9ea652be2a921f930d0ec21dcfc1d61b15e0ea2cd22ad4141eeb4e9552","scripts/codeoutline/analysis/cpp/cpp_types.lua":"18e68635a30f86a8975cc556839ed2be961685353dec290749fd169d3049cf16","scripts/codeoutline/analysis/ordinary_bindings.lua":"ec9f3609650f2ec05dd429e178118a4dded9b6c40cfecdd5efcdeb5e0bb2ad94","scripts/codeoutline/query/definition_candidates.lua":"4ae55444daacc2ea2f52635781ef4127811849fb6f04a62c62411853c75eced0","scripts/codeoutline/cli.lua":"28b058bbb3c86d9e6a7603c52ef62eacc8978af6c2201e61bfb8100bc79be4b2","scripts/codeoutline/install/agent_config.lua":"041e1736f7be060b9eac9f3ced0b20f50854d94af2cddfa22c5d3868f3fc1681","editors/codeoutline.vsix":"2b295d0e76565c3cf5935282c3f59c65bf7323060eb3ba76622cd5cf0633364c","scripts/codeoutline/analysis/cpp/cpp_receivers.lua":"4f9bea5325d0ccd3ddfe5117bf8891408d41988bdc94d6a388363624b64df0f3","scripts/codeoutline/query/documents.lua":"1ed27cb6f805c1ff9acbc070f16e582b71c4a330c5539fb3d7b8ed4150c82bdf","scripts/codeoutline/install/agent_install.lua":"32409b49dd1e8436169f334587b4994c9d6868ed3ff5c4eaed09b4b3b8ca12c4"},"target":"win32-x64","version":"0.3.8","updateSequence":27}
|
package/editors/codeoutline.vsix
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"name":"@codua/codeoutline-win32-x64","os":["win32"],"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","files":["bin/","lib/","keys/","scripts/","editors/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"cpu":["x64","arm64"],"license":"BSD-2-Clause","version":"0.3.8","repository":{"url":"git+https://github.com/1dao/codeoutline.git","type":"git"}}
|
|
@@ -550,6 +550,7 @@ function M.add_file(G, rel, rec)
|
|
|
550
550
|
ids[n] = id
|
|
551
551
|
insert(G, G.by_name, node.name, id, node_before)
|
|
552
552
|
for _, alias in ipairs(lua_bindings.aliases(node, G.lua_global_export_tables)) do insert(G, G.by_name, alias, id, node_before) end
|
|
553
|
+
for _, alias in ipairs(lua_bindings.member_aliases(node)) do insert(G, G.by_name, alias, id, node_before) end
|
|
553
554
|
insert(G, G.by_lname, node.name:lower(), id, node_before)
|
|
554
555
|
insert(G, G.by_qualified, node.qualified, id, node_before)
|
|
555
556
|
local owner = M.owner(node.qualified)
|
|
@@ -568,6 +569,7 @@ function M.remove_file(G, rel)
|
|
|
568
569
|
local node = G.nodes[id]
|
|
569
570
|
remove(G, G.by_name, node.name, id, node_before)
|
|
570
571
|
for _, alias in ipairs(lua_bindings.aliases(node, G.lua_global_export_tables)) do remove(G, G.by_name, alias, id, node_before) end
|
|
572
|
+
for _, alias in ipairs(lua_bindings.member_aliases(node)) do remove(G, G.by_name, alias, id, node_before) end
|
|
571
573
|
remove(G, G.by_lname, node.name:lower(), id, node_before)
|
|
572
574
|
remove(G, G.by_qualified, node.qualified, id, node_before)
|
|
573
575
|
local owner = M.owner(node.qualified)
|
|
@@ -3,6 +3,7 @@ local M = {}
|
|
|
3
3
|
local control = require('codeoutline.shared.control')
|
|
4
4
|
local loaders = { require = true, dofile = true, loadfile = true }
|
|
5
5
|
local EXPORT_OWNER = '__exports'
|
|
6
|
+
local EMPTY = {}
|
|
6
7
|
-- Loader call at token j: a known loader name, or any dotted/plain name whose
|
|
7
8
|
-- last segment ends in `import` (`ks.import`, `skynet_import`). Returns the
|
|
8
9
|
-- kind recorded in lua_imports, the callee's last token, and the base name
|
|
@@ -41,6 +42,37 @@ local function binding_at(bindings, name, token)
|
|
|
41
42
|
return best
|
|
42
43
|
end
|
|
43
44
|
|
|
45
|
+
-- A nil-initialized local can receive a module in a sibling if block. Keep
|
|
46
|
+
-- possible imports at later uses, and stop on a write we cannot model. Only the
|
|
47
|
+
-- last write of each branch survives; sibling branches keep their source order.
|
|
48
|
+
local function conditional_hint(bindings, name, base, token, T, offset)
|
|
49
|
+
if not base or not base.nil_local then return nil end
|
|
50
|
+
local writes = bindings[name]
|
|
51
|
+
if #writes > 32 then return nil end
|
|
52
|
+
local branches, last, seen = {}, {}, {}
|
|
53
|
+
for _, write in ipairs(writes) do
|
|
54
|
+
local finished = token and write.b < token or offset and T.e[write.b] <= offset
|
|
55
|
+
if base.token < write.token and finished then
|
|
56
|
+
if write.assignment then
|
|
57
|
+
if not write.branch or write.outer ~= base.a then return nil end
|
|
58
|
+
local arm = write.arm or write.a
|
|
59
|
+
if not seen[arm] then seen[arm], branches[#branches + 1] = true, arm end
|
|
60
|
+
last[arm] = write
|
|
61
|
+
elseif write.if_local and write.outer == base.a then
|
|
62
|
+
-- Branch-local declarations can hide a different variable.
|
|
63
|
+
return nil
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
local imports = {}
|
|
68
|
+
for _, scope in ipairs(branches) do
|
|
69
|
+
local import = last[scope].branch_import
|
|
70
|
+
if import then imports[#imports + 1] = import end
|
|
71
|
+
end
|
|
72
|
+
if #imports == 1 then return 'lua:' .. imports[1] end
|
|
73
|
+
if #imports > 1 then return 'lua-conditional:' .. table.concat(imports, ',') end
|
|
74
|
+
end
|
|
75
|
+
|
|
44
76
|
local function metatable_import(T, bindings, bound)
|
|
45
77
|
if not bound then return nil end
|
|
46
78
|
local call = bound.token + 2
|
|
@@ -59,6 +91,11 @@ local function metatable_import(T, bindings, bound)
|
|
|
59
91
|
return base and tonumber(base.hint:match('^lua:(%d+)$'))
|
|
60
92
|
end
|
|
61
93
|
|
|
94
|
+
local function declared_local(T, params, token)
|
|
95
|
+
return T:text(token - 1) == 'local' or params[token] ~= nil
|
|
96
|
+
or T:text(token - 1) == 'function' and T:text(token - 2) == 'local'
|
|
97
|
+
end
|
|
98
|
+
|
|
62
99
|
-- Shared lexical table-member lookup for normal references and query-only
|
|
63
100
|
-- configured callback aliases. Results are local parser node indices.
|
|
64
101
|
function M.local_members(nodes, scopes, name, token, scope, finish)
|
|
@@ -76,6 +113,9 @@ function M.collect(r, T, bm)
|
|
|
76
113
|
r.lua_imports, r.lua_exports, r.lua_locals = {}, {}, {}
|
|
77
114
|
local details = not r.defer_analysis and (r.ranges or r.ordinary_bindings)
|
|
78
115
|
local scopes, stack, params, bindings, function_scopes = {}, {}, {}, {}, {}
|
|
116
|
+
-- Query-only: `then`/`else` do not open a block, so every arm of one `if`
|
|
117
|
+
-- shares its scope. Arm openings tell sequential writes from alternatives.
|
|
118
|
+
local arms = {}
|
|
79
119
|
for i = 1, T.n do
|
|
80
120
|
if stack[#stack] and bm[stack[#stack]] == i then stack[#stack] = nil end
|
|
81
121
|
scopes[i] = stack[#stack] or 0
|
|
@@ -83,13 +123,21 @@ function M.collect(r, T, bm)
|
|
|
83
123
|
function_scopes[i] = T:text(i) == 'function' or function_scopes[scopes[i]]
|
|
84
124
|
stack[#stack + 1] = i
|
|
85
125
|
end
|
|
126
|
+
if details and T.k[i] == 'kw' then
|
|
127
|
+
local text = T:text(i)
|
|
128
|
+
if text == 'then' or text == 'else' then
|
|
129
|
+
local list = arms[scopes[i]]
|
|
130
|
+
if not list then list = {}; arms[scopes[i]] = list end
|
|
131
|
+
list[#list + 1] = i
|
|
132
|
+
end
|
|
133
|
+
end
|
|
86
134
|
if T:text(i) == 'function' and T.k[i] == 'kw' then
|
|
87
135
|
local p = i + 1
|
|
88
136
|
while p < (bm[i] or i) and T:text(p) ~= '(' do p = p + 1 end
|
|
89
137
|
for j = p + 1, (T.m[p] or p) - 1 do if T.k[j] == 'id' then params[j] = i end end
|
|
90
138
|
end
|
|
91
139
|
end
|
|
92
|
-
local function add(name, token, scope, hint, imported)
|
|
140
|
+
local function add(name, token, scope, hint, imported, finish)
|
|
93
141
|
bindings[name] = bindings[name] or {}
|
|
94
142
|
-- Reassignment/parameter shadowing must not revive a global name
|
|
95
143
|
-- after a loader value was bound under this lexical name.
|
|
@@ -98,7 +146,31 @@ function M.collect(r, T, bm)
|
|
|
98
146
|
if b.imported and b.token < token and b.a <= token and b.b >= token then imported = true end
|
|
99
147
|
end
|
|
100
148
|
end
|
|
101
|
-
|
|
149
|
+
local binding = { token = token, a = scope, b = bm[scope] or T.n, hint = hint, imported = imported }
|
|
150
|
+
bindings[name][#bindings[name] + 1] = binding
|
|
151
|
+
if details then
|
|
152
|
+
local local_decl = T:text(token - 1) == 'local'
|
|
153
|
+
local next = T:text(token + 1)
|
|
154
|
+
binding.local_declaration = declared_local(T, params, token)
|
|
155
|
+
binding.nil_local = local_decl and (next == '=' and T:text(token + 2) == 'nil' and value_end(T, token + 3)
|
|
156
|
+
or next ~= '=' and next ~= ',' and (T.k[token + 1] ~= 'op' or next == ';'))
|
|
157
|
+
binding.assignment = not local_decl and not params[token] and next == '='
|
|
158
|
+
if T:text(scope) == 'if' then
|
|
159
|
+
binding.outer = scopes[scope]
|
|
160
|
+
binding.if_local = local_decl or T:text(token - 2) == 'local' and T:text(token - 1) == 'function'
|
|
161
|
+
local index = hint:match('^lua:(%d+)$')
|
|
162
|
+
local last = index and finish or T:text(token + 2) == 'nil' and token + 2
|
|
163
|
+
-- Any top-level write in the branch counts; the scope check
|
|
164
|
+
-- already excludes writes nested in a deeper block.
|
|
165
|
+
if binding.assignment and last and value_end(T, last + 1) then
|
|
166
|
+
binding.branch = true
|
|
167
|
+
binding.branch_import = index
|
|
168
|
+
for _, opening in ipairs(arms[scope] or EMPTY) do
|
|
169
|
+
if opening < token then binding.arm = opening else break end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
102
174
|
end
|
|
103
175
|
for i = 1, T.n do
|
|
104
176
|
if i % 4096 == 0 then control.check() end
|
|
@@ -109,7 +181,7 @@ function M.collect(r, T, bm)
|
|
|
109
181
|
elseif prev == 'local' or (next == '=' and prev ~= '.' and prev ~= ':' and prev ~= '{' and prev ~= ',') then
|
|
110
182
|
local hint = '?'
|
|
111
183
|
if next == '=' and T:text(i + 2) == '{' then hint = 'lua-local:' .. T:text(i) end
|
|
112
|
-
local kind, call, base
|
|
184
|
+
local kind, call, base, finish
|
|
113
185
|
if next == '=' then kind, call, base = loader_call(T, i + 2) end
|
|
114
186
|
local imported = kind ~= nil
|
|
115
187
|
if kind then
|
|
@@ -130,6 +202,7 @@ function M.collect(r, T, bm)
|
|
|
130
202
|
r.lua_imports[#r.lua_imports + 1] = { path = path, kind = kind,
|
|
131
203
|
member = member and T:text(member) or nil }
|
|
132
204
|
hint = (member and 'lua-value:' or 'lua:') .. #r.lua_imports
|
|
205
|
+
finish = close
|
|
133
206
|
if kind == 'loadfile' then hint = '?' end
|
|
134
207
|
if member and kind ~= 'loadfile' then
|
|
135
208
|
r.refs[#r.refs + 1] = { tok = member, name = T:text(member), kind = 'ref',
|
|
@@ -140,7 +213,7 @@ function M.collect(r, T, bm)
|
|
|
140
213
|
end
|
|
141
214
|
end
|
|
142
215
|
-- Keep ordinary local function/table lookup; block unknown imported receivers.
|
|
143
|
-
add(T:text(i), i, scopes[i], hint, imported)
|
|
216
|
+
add(T:text(i), i, scopes[i], hint, imported, finish)
|
|
144
217
|
end
|
|
145
218
|
end
|
|
146
219
|
end
|
|
@@ -233,7 +306,8 @@ function M.collect(r, T, bm)
|
|
|
233
306
|
local best = binding_at(bindings, ref.recv or ref.name, ref.tok)
|
|
234
307
|
if best and (ref.recv or best.imported) then
|
|
235
308
|
local value = best.hint:match('^lua%-value:')
|
|
236
|
-
|
|
309
|
+
local hint = ref.recv and conditional_hint(bindings, ref.recv, best, ref.tok) or best.hint
|
|
310
|
+
ref.lua_binding = value and (not ref.recv and hint or '?') or (ref.recv and hint or '?')
|
|
237
311
|
end
|
|
238
312
|
if ref.recv == 'self' and not best then ref.lua_binding = '?' end
|
|
239
313
|
if ref.recv and (T:text(ref.tok - 3) == '.' or T:text(ref.tok - 3) == ':') then ref.lua_binding = '?' end
|
|
@@ -270,20 +344,31 @@ function M.collect(r, T, bm)
|
|
|
270
344
|
end
|
|
271
345
|
end
|
|
272
346
|
end
|
|
347
|
+
-- Only a local declaration or parameter hides a project-wide table name.
|
|
348
|
+
-- `Logger = {}` is a global assignment, so its members stay global aliases.
|
|
349
|
+
local function local_owner(name, token)
|
|
350
|
+
local list = bindings[name]
|
|
351
|
+
if not list then return false end
|
|
352
|
+
for _, b in ipairs(list) do
|
|
353
|
+
if b.token <= token and b.a <= token and b.b >= token
|
|
354
|
+
and declared_local(T, params, b.token) then return true end
|
|
355
|
+
end
|
|
356
|
+
return false
|
|
357
|
+
end
|
|
273
358
|
-- A global alias is a statement of its own: the right-hand side is a bare
|
|
274
359
|
-- identifier and nothing but a separator follows it on that line. The key
|
|
275
360
|
-- is dotted (`g_exports.name`) or a literal (`g_exports['name']`).
|
|
276
361
|
local globals, definitions = {}, {}
|
|
277
362
|
for index, n in ipairs(r.nodes) do
|
|
278
363
|
local owner, key = n.qualified:match('^([%a_][%w_]*)[.:]([%a_][%w_]*)$')
|
|
279
|
-
if owner and not
|
|
364
|
+
if owner and not local_owner(owner, n.ti) and not n.parent and (n.kind == 'function' or n.kind == 'method') then
|
|
280
365
|
definitions[n.ti] = { owner = owner, key = key, index = index }
|
|
281
366
|
end
|
|
282
367
|
end
|
|
283
368
|
for i = 1, T.n - 4 do
|
|
284
369
|
if i % 4096 == 0 then control.check() end
|
|
285
370
|
local owner = T:text(i)
|
|
286
|
-
if T.k[i] == 'id' and not
|
|
371
|
+
if T.k[i] == 'id' and not local_owner(owner, i) and T:text(i - 1) ~= '.' and T:text(i - 1) ~= ':' then
|
|
287
372
|
local key, eq
|
|
288
373
|
if T:text(i + 1) == '.' and T.k[i + 2] == 'id' then key, eq = T:text(i + 2), i + 3
|
|
289
374
|
elseif T:text(i + 1) == '[' and T.m[i + 1] == i + 3 and T.k[i + 2] == 'str' then key, eq = literal(T, i + 2), i + 4 end
|
|
@@ -467,7 +552,6 @@ function M.context(G)
|
|
|
467
552
|
return ctx
|
|
468
553
|
end
|
|
469
554
|
-- Project-selected aliases share the normal name index and overlay path.
|
|
470
|
-
local EMPTY = {}
|
|
471
555
|
function M.aliases(node, owners)
|
|
472
556
|
if not node.lua_aliases then return EMPTY end
|
|
473
557
|
local names, seen = {}, {}
|
|
@@ -487,6 +571,29 @@ function M.exported(node, name, owners)
|
|
|
487
571
|
end
|
|
488
572
|
return false
|
|
489
573
|
end
|
|
574
|
+
-- A member alias is only nameable through its owner (`Logger.es`), so it never
|
|
575
|
+
-- publishes the bare key. Direct definitions already carry the dotted name.
|
|
576
|
+
function M.member_aliases(node)
|
|
577
|
+
if not node.lua_aliases then return EMPTY end
|
|
578
|
+
local names, seen = {}, {}
|
|
579
|
+
for owner, keys in pairs(node.lua_aliases) do
|
|
580
|
+
for _, name in ipairs(keys) do
|
|
581
|
+
local qualified = owner .. '.' .. name
|
|
582
|
+
if name ~= node.name and not seen[qualified] then
|
|
583
|
+
names[#names + 1], seen[qualified] = qualified, true
|
|
584
|
+
end
|
|
585
|
+
end
|
|
586
|
+
end
|
|
587
|
+
table.sort(names)
|
|
588
|
+
return names
|
|
589
|
+
end
|
|
590
|
+
function M.member_alias(node, qualified)
|
|
591
|
+
if not node.lua_aliases or not qualified then return false end
|
|
592
|
+
local owner, name = qualified:match('^([%a_][%w_]*)%.([%a_][%w_]*)$')
|
|
593
|
+
if not owner then return false end
|
|
594
|
+
for _, alias in ipairs(node.lua_aliases[owner] or EMPTY) do if alias == name then return true end end
|
|
595
|
+
return false
|
|
596
|
+
end
|
|
490
597
|
function M.modules(G, imp, ctx)
|
|
491
598
|
ctx = ctx or M.context(G)
|
|
492
599
|
local key = imp.kind .. '\0' .. imp.path
|
|
@@ -536,13 +643,50 @@ function M.native_modules(G, name, ctx)
|
|
|
536
643
|
return require('codeoutline.analysis.foreign').modules(G, 'lua', name, ctx)
|
|
537
644
|
end
|
|
538
645
|
|
|
646
|
+
function M.has_local_receiver(T, name, offset)
|
|
647
|
+
for _, binding in ipairs((T.lua_bindings or EMPTY)[name] or EMPTY) do
|
|
648
|
+
if binding.local_declaration and T.s[binding.token] - 1 <= offset
|
|
649
|
+
and (binding.a == 0 or offset < T.e[binding.b]) then return true end
|
|
650
|
+
end
|
|
651
|
+
return false
|
|
652
|
+
end
|
|
653
|
+
|
|
539
654
|
-- Shared query-time receiver resolution for completion and navigation. Reuse
|
|
540
655
|
-- the parser's lexical bindings and loader contracts; never execute Lua.
|
|
541
656
|
local function module_target(G, imp, ctx)
|
|
542
657
|
return { modules = M.modules(G, imp, ctx), module_name = imp.path }
|
|
543
658
|
end
|
|
544
659
|
|
|
660
|
+
local function imported_target(G, rec, hint, ctx)
|
|
661
|
+
local index = tonumber(hint:match('^lua:(%d+)$'))
|
|
662
|
+
if index then
|
|
663
|
+
local imp = (rec.lua_imports or EMPTY)[index]
|
|
664
|
+
return imp and module_target(G, imp, ctx)
|
|
665
|
+
end
|
|
666
|
+
local branches = hint:match('^lua%-conditional:([%d,]+)$')
|
|
667
|
+
if not branches then return nil end
|
|
668
|
+
local alternatives, seen = {}, {}
|
|
669
|
+
for i in branches:gmatch('%d+') do
|
|
670
|
+
local imp = rec.lua_imports[tonumber(i)]
|
|
671
|
+
local key = imp.kind .. '\0' .. imp.path
|
|
672
|
+
if not seen[key] then
|
|
673
|
+
seen[key] = true
|
|
674
|
+
alternatives[#alternatives + 1] = module_target(G, imp, ctx)
|
|
675
|
+
end
|
|
676
|
+
end
|
|
677
|
+
return { alternatives = alternatives }
|
|
678
|
+
end
|
|
679
|
+
|
|
545
680
|
function M.member(G, target, name)
|
|
681
|
+
if target and target.alternatives then
|
|
682
|
+
local result, seen = {}, {}
|
|
683
|
+
for _, alternative in ipairs(target.alternatives) do
|
|
684
|
+
for _, entry in ipairs(M.member(G, alternative, name)) do
|
|
685
|
+
if not seen[entry.node] then seen[entry.node] = true; result[#result + 1] = entry end
|
|
686
|
+
end
|
|
687
|
+
end
|
|
688
|
+
return result
|
|
689
|
+
end
|
|
546
690
|
local result = {}
|
|
547
691
|
for _, f in ipairs(target and target.modules or {}) do
|
|
548
692
|
local rec = G.files[f]
|
|
@@ -579,11 +723,9 @@ function M.receiver(G, rec, T, name, offset, ctx, depth)
|
|
|
579
723
|
target.lua_self = best.self_info
|
|
580
724
|
return target, true
|
|
581
725
|
end
|
|
582
|
-
local
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
return module_target(G, imp, ctx), true
|
|
586
|
-
end
|
|
726
|
+
local hint = conditional_hint(T.lua_bindings, name, best, nil, T, offset) or best.hint
|
|
727
|
+
local imported = imported_target(G, rec, hint, ctx)
|
|
728
|
+
if imported then return imported, true end
|
|
587
729
|
local i = best.token + 2
|
|
588
730
|
if best.imported or T:text(best.token + 1) ~= '=' or T.k[i] ~= 'id' then return nil, true end
|
|
589
731
|
local target = M.receiver(G, rec, T, T:text(i), T.s[best.token] - 1, ctx, depth + 1)
|
|
@@ -642,16 +784,17 @@ function M.resolve(G, f, name, hint, ctx, recv)
|
|
|
642
784
|
return n and { G.id_of[f][n] } or {}
|
|
643
785
|
end
|
|
644
786
|
local value = tonumber(hint:match('^lua%-value:(%d+)$'))
|
|
645
|
-
local
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
787
|
+
local rec = G.files[f]
|
|
788
|
+
if value then
|
|
789
|
+
local imp = (rec.lua_imports or EMPTY)[value]
|
|
790
|
+
if not imp then return nil end
|
|
791
|
+
name, hint = imp.member, 'lua:' .. value
|
|
792
|
+
end
|
|
793
|
+
local target = imported_target(G, rec, hint, ctx)
|
|
794
|
+
if not target then return nil end
|
|
649
795
|
local result = {}
|
|
650
|
-
for _,
|
|
651
|
-
|
|
652
|
-
local exports = require('codeoutline.analysis.foreign').exports(rec, 'lua', imp.path) or rec.lua_exports
|
|
653
|
-
local n = (exports or {})[name]
|
|
654
|
-
if n then result[#result + 1] = G.id_of[target][n] end
|
|
796
|
+
for _, entry in ipairs(M.member(G, target, name)) do
|
|
797
|
+
result[#result + 1] = G.id_of[entry.file][entry.index]
|
|
655
798
|
end
|
|
656
799
|
return result
|
|
657
800
|
end
|
|
@@ -10,7 +10,7 @@ function M.at(meta, name, offset)
|
|
|
10
10
|
local best, index, future
|
|
11
11
|
for _, i in ipairs(meta and meta.by_name[name] or {}) do
|
|
12
12
|
local b = meta.bindings[i]
|
|
13
|
-
if b.first <= offset and offset < b.last and b.at <= offset
|
|
13
|
+
if b.first <= offset and offset < b.last and b.at <= offset and (not b.branch_end or offset < b.branch_end)
|
|
14
14
|
and (not best or b.first > best.first or b.first == best.first and b.at > best.at) then best, index = b, i end
|
|
15
15
|
if b.hoisted and b.first <= offset and offset < b.last and b.at > offset
|
|
16
16
|
and (not future or b.first > future.first) then future = b end
|
|
@@ -19,19 +19,131 @@ function M.at(meta, name, offset)
|
|
|
19
19
|
return best, index
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
-- Collect simple if/else joins using existing delimiter matches. Assignments in
|
|
23
|
+
-- compound bodies stay with the language's ordinary lexical analysis.
|
|
24
|
+
local function join_conditionals(T, language, assignments, meta, add)
|
|
25
|
+
local python = language == 'python'
|
|
26
|
+
local function text(i) return T:text(i) end
|
|
27
|
+
local function end_offset(close) return python and T.s[close] - 1 or T.e[close] end
|
|
28
|
+
local function arm_at(i)
|
|
29
|
+
if python then
|
|
30
|
+
local limit = i + 128
|
|
31
|
+
while i <= T.n and T.k[i] ~= 'nl' do
|
|
32
|
+
if i > limit then return nil end
|
|
33
|
+
i = (T.m[i] and T.m[i] > i and T.m[i] or i) + 1
|
|
34
|
+
end
|
|
35
|
+
i = i + 1
|
|
36
|
+
if T.k[i] ~= 'indent' then return nil end
|
|
37
|
+
else
|
|
38
|
+
if text(i) == '(' then i = T.m[i] and T.m[i] + 1 or i end
|
|
39
|
+
if text(i) ~= '{' then return nil end
|
|
40
|
+
end
|
|
41
|
+
local close = T.m[i]
|
|
42
|
+
if not close then return nil end
|
|
43
|
+
local first = i + 1
|
|
44
|
+
while T.k[first] == 'nl' do first = first + 1 end
|
|
45
|
+
if first == close or (python and text(first) == 'pass' and first + 2 == close) then return close end
|
|
46
|
+
local b = assignments[first]
|
|
47
|
+
if not b or text(first + 1) ~= '=' then return nil end
|
|
48
|
+
-- Check that the assignment occupies the arm. A second statement or
|
|
49
|
+
-- a nested block needs richer control-flow analysis.
|
|
50
|
+
local j = first + 2
|
|
51
|
+
while j < close and text(j) ~= ';' and T.k[j] ~= 'nl' do
|
|
52
|
+
if j > first + 128 then return nil end
|
|
53
|
+
if text(j) == '{' and not T.m[j] then return nil end
|
|
54
|
+
if not python and j > first + 2 and T.l[j] > T.el[j - 1] then return nil end
|
|
55
|
+
j = (T.m[j] and T.m[j] > j and T.m[j] or j) + 1
|
|
56
|
+
end
|
|
57
|
+
local last = j
|
|
58
|
+
if text(j) == ';' then j = j + 1 end
|
|
59
|
+
while T.k[j] == 'nl' do j = j + 1 end
|
|
60
|
+
if j ~= close then return nil end
|
|
61
|
+
local value = first + 2
|
|
62
|
+
if not python and text(value) == 'new' then value = value + 1 end
|
|
63
|
+
value = value + 1
|
|
64
|
+
while text(value) == '.' and T.k[value + 1] == 'id' do value = value + 2 end
|
|
65
|
+
if text(value) == '(' and T.m[value] then value = T.m[value] + 1 end
|
|
66
|
+
return close, b, value == last
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
local blocks = {}
|
|
70
|
+
for i = 1, T.n do
|
|
71
|
+
if i % 1024 == 0 then control.check() end
|
|
72
|
+
while blocks[#blocks] and blocks[#blocks] <= i do blocks[#blocks] = nil end
|
|
73
|
+
if (python and T.k[i] == 'indent' or not python and text(i) == '{') and T.m[i] and T.m[i] > i then
|
|
74
|
+
blocks[#blocks + 1] = T.m[i]
|
|
75
|
+
end
|
|
76
|
+
if T.k[i] == 'kw' and text(i) == 'if' and (python and (i == 1 or T.k[i - 1] == 'nl'
|
|
77
|
+
or T.k[i - 1] == 'indent' or T.k[i - 1] == 'dedent') or not python and text(i - 1) ~= 'else') then
|
|
78
|
+
local arms, next_arm, has_else = {}, i + 1, false
|
|
79
|
+
while next_arm and #arms < 8 do
|
|
80
|
+
local close, assignment, simple_value = arm_at(next_arm)
|
|
81
|
+
if not close then break end
|
|
82
|
+
arms[#arms + 1] = { close = close, assignment = assignment, simple_value = simple_value }
|
|
83
|
+
local after = close + (python and 0 or 1)
|
|
84
|
+
if python and T.k[after] == 'dedent' then after = after + 1 end
|
|
85
|
+
if python and text(after) == 'elif' then next_arm = after + 1
|
|
86
|
+
elseif text(after) == 'else' and not has_else then
|
|
87
|
+
has_else = python or text(after + 1) ~= 'if'
|
|
88
|
+
next_arm = after + (has_else and 1 or 2)
|
|
89
|
+
else next_arm = nil end
|
|
90
|
+
end
|
|
91
|
+
if not next_arm then
|
|
92
|
+
local writes, count = {}, {}
|
|
93
|
+
for _, arm in ipairs(arms) do
|
|
94
|
+
local b = arm.assignment
|
|
95
|
+
if b then writes[b.name] = b; count[b.name] = (count[b.name] or 0) + 1 end
|
|
96
|
+
end
|
|
97
|
+
for name, sample in pairs(writes) do
|
|
98
|
+
local before = M.at(meta, name, T.s[i] - 1)
|
|
99
|
+
if python and before and before.blocked and not before.name then before = nil end
|
|
100
|
+
if python or before and not before.blocked and before.first < sample.first then
|
|
101
|
+
local values, seen, unknown, empty = {}, {}, false, false
|
|
102
|
+
local function include(b)
|
|
103
|
+
if not b or b.empty then empty = true end
|
|
104
|
+
if not b then return end
|
|
105
|
+
for _, value in ipairs(b.alternatives or { b }) do
|
|
106
|
+
if value.type or value.owner then
|
|
107
|
+
local key = (value.type or '') .. '\0' .. tostring(value.owner) .. '\0' .. tostring(value.static)
|
|
108
|
+
if not seen[key] then seen[key] = true; values[#values + 1] = value end
|
|
109
|
+
elseif not value.empty then unknown = true end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
if not has_else or count[name] < #arms then include(before) end
|
|
113
|
+
for _, arm in ipairs(arms) do
|
|
114
|
+
local b = arm.assignment
|
|
115
|
+
if b and b.name == name then
|
|
116
|
+
if arm.simple_value then include(b) else unknown = true end
|
|
117
|
+
if python then b.branch_end = end_offset(arm.close) end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
local close = arms[#arms].close
|
|
121
|
+
local scope = python and sample or before
|
|
122
|
+
local parent_end = blocks[#blocks]
|
|
123
|
+
local last = parent_end and math.min(scope.last, end_offset(parent_end)) or scope.last
|
|
124
|
+
local value = not unknown and #values <= 8 and { alternatives = values, empty = empty } or { blocked = true }
|
|
125
|
+
add(name, close, scope.first, last, value, end_offset(close))
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
22
133
|
function M.collect(r, T)
|
|
23
134
|
local language = r.language
|
|
24
135
|
if language ~= 'python' and language ~= 'kotlin' and not js(language) then return end
|
|
25
136
|
local meta = { bindings = {}, by_name = {}, statics = {}, fields = {}, weight = 128 }
|
|
26
137
|
r.receivers = meta
|
|
27
|
-
local function add(name, token, first, last, value)
|
|
138
|
+
local function add(name, token, first, last, value, at)
|
|
28
139
|
if #meta.bindings >= M.MAX_BINDINGS then meta.incomplete = true; return end
|
|
29
|
-
local b = { name = name, at = token > 0 and T.s[token] - 1 or 0, first = first, last = last,
|
|
140
|
+
local b = { name = name, at = at or (token > 0 and T.s[token] - 1 or 0), first = first, last = last,
|
|
30
141
|
owner = value and value.owner, type = value and value.type, static = value and value.static,
|
|
31
|
-
super = value and value.super
|
|
142
|
+
super = value and value.super, alternatives = value and value.alternatives,
|
|
143
|
+
empty = value and value.empty, blocked = value and value.blocked }
|
|
32
144
|
local n = #meta.bindings + 1; meta.bindings[n] = b
|
|
33
145
|
meta.by_name[name] = meta.by_name[name] or {}; table.insert(meta.by_name[name], n)
|
|
34
|
-
meta.weight = meta.weight + 192 + #name + #(b.type or '')
|
|
146
|
+
meta.weight = meta.weight + 192 + #name + #(b.type or '') + 16 * #(b.alternatives or {})
|
|
35
147
|
if name == 'this' and js(language) then
|
|
36
148
|
add('super', token, first, last, { owner = b.owner, type = b.type, static = b.static, super = true })
|
|
37
149
|
end
|
|
@@ -53,6 +165,7 @@ function M.collect(r, T)
|
|
|
53
165
|
while text(j) == '.' and T.k[j + 1] == 'id' do parts[#parts + 1] = text(j + 1); j = j + 2 end
|
|
54
166
|
return table.concat(parts, '.'), j
|
|
55
167
|
end
|
|
168
|
+
local assignments = {}
|
|
56
169
|
if language == 'kotlin' then
|
|
57
170
|
local declarations = {}
|
|
58
171
|
for _, node in ipairs(r.nodes) do
|
|
@@ -142,11 +255,12 @@ function M.collect(r, T)
|
|
|
142
255
|
local value
|
|
143
256
|
if next == '=' or next == ':=' then
|
|
144
257
|
local name, after = written(i + 2)
|
|
145
|
-
if
|
|
258
|
+
if text(i + 2) == 'None' and (T.k[i + 3] == 'nl' or text(i + 3) == ';') then value = { empty = true }
|
|
259
|
+
elseif name and text(after) == '(' then value = { type = name }
|
|
146
260
|
elseif name then value = M.at(meta, name, T.s[i] - 1) end
|
|
147
261
|
end
|
|
148
262
|
local b = add(text(i), i, first, last, value)
|
|
149
|
-
if b then b.hoisted = true end
|
|
263
|
+
if b then b.hoisted = true; if next == '=' then assignments[i] = b end end
|
|
150
264
|
end
|
|
151
265
|
if T.k[i] == 'id' and prev == 'for' and next == 'in' and depth > 0 then
|
|
152
266
|
local open = brackets[#brackets]
|
|
@@ -212,6 +326,10 @@ function M.collect(r, T)
|
|
|
212
326
|
local bindings = {}
|
|
213
327
|
for _, list in pairs(T.js_bindings or {}) do for _, b in ipairs(list) do bindings[#bindings + 1] = b end end
|
|
214
328
|
table.sort(bindings, function(a, b) return a.token < b.token end)
|
|
329
|
+
local function ends_statement(i)
|
|
330
|
+
return text(i) == ';' or text(i) == '}' or text(i) == ''
|
|
331
|
+
or (T.k[i] == 'id' or T.k[i] == 'kw') and T.l[i] > T.el[i - 1]
|
|
332
|
+
end
|
|
215
333
|
for _, b in ipairs(bindings) do
|
|
216
334
|
local first = b.a > 0 and T.s[b.a] - 1 or 0
|
|
217
335
|
local last = b.b > 0 and T.e[b.b] + 1 or #T.src + 1
|
|
@@ -219,10 +337,25 @@ function M.collect(r, T)
|
|
|
219
337
|
if text(b.token + 1) == '=' and (text(b.token + 2) == 'this' or T.k[b.token + 2] == 'id') then
|
|
220
338
|
value = value or M.at(meta, text(b.token + 2), T.s[b.token] - 1)
|
|
221
339
|
end
|
|
340
|
+
if not value then
|
|
341
|
+
local tail = b.token + 1
|
|
342
|
+
local _, after = written(b.token + 2)
|
|
343
|
+
if text(tail) == ':' and after and text(after) == '|'
|
|
344
|
+
and (text(after + 1) == 'undefined' or text(after + 1) == 'null') then tail = after + 2 end
|
|
345
|
+
local nil_value = text(tail + 1) == 'null' or text(tail + 1) == 'undefined'
|
|
346
|
+
and not M.at(meta, 'undefined', T.s[b.token] - 1)
|
|
347
|
+
if b.declaration and ends_statement(tail) or text(tail) == '=' and nil_value and ends_statement(tail + 2) then
|
|
348
|
+
value = { empty = true }
|
|
349
|
+
end
|
|
350
|
+
end
|
|
222
351
|
local added = add(b.name, b.token, first, last, value)
|
|
223
|
-
if added then
|
|
352
|
+
if added then
|
|
353
|
+
added.hoisted = b.declaration
|
|
354
|
+
if not b.declaration then assignments[b.token] = added end
|
|
355
|
+
end
|
|
224
356
|
end
|
|
225
357
|
end
|
|
358
|
+
if next(assignments) then join_conditionals(T, language, assignments, meta, add) end
|
|
226
359
|
for _, ref in ipairs(r.refs) do
|
|
227
360
|
if ref.recv and text(ref.tok - 3) ~= '.' and text(ref.tok - 3) ~= '?.' then
|
|
228
361
|
local name = ref.recv
|
|
@@ -291,6 +424,19 @@ end
|
|
|
291
424
|
|
|
292
425
|
local function from_binding(G, f, b, ctx)
|
|
293
426
|
if not b then return nil end
|
|
427
|
+
if b.alternatives then
|
|
428
|
+
local ids, seen, static = {}, {}, nil
|
|
429
|
+
for _, alternative in ipairs(b.alternatives) do
|
|
430
|
+
local target = from_binding(G, f, alternative, ctx)
|
|
431
|
+
local mode = target.static == true
|
|
432
|
+
if #target.ids == 0 or static ~= nil and static ~= mode then ids = {}; break end
|
|
433
|
+
static = mode
|
|
434
|
+
for _, id in ipairs(target.ids) do
|
|
435
|
+
if not seen[id] then seen[id] = true; ids[#ids + 1] = id end
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
return { kind = 'types', ids = ids, static = static, language = G.files[f].language, file = f }
|
|
439
|
+
end
|
|
294
440
|
local ids = b.owner and { G.id_of[f][b.owner] } or M.types(G, f, b.type, ctx)
|
|
295
441
|
if b.super then
|
|
296
442
|
local bases = {}
|
|
@@ -357,7 +503,7 @@ local function field_visible(target, bound)
|
|
|
357
503
|
end
|
|
358
504
|
|
|
359
505
|
function M.member_ids(G, target, name, ctx, accept)
|
|
360
|
-
local result = {}
|
|
506
|
+
local result, emitted = {}, {}
|
|
361
507
|
for _, cls in ipairs(target.ids or {}) do
|
|
362
508
|
local chain = ancestors(G, cls, ctx)
|
|
363
509
|
for _, id in ipairs(chain or {}) do
|
|
@@ -381,7 +527,12 @@ function M.member_ids(G, target, name, ctx, accept)
|
|
|
381
527
|
end
|
|
382
528
|
end
|
|
383
529
|
end
|
|
384
|
-
if shadowed then
|
|
530
|
+
if shadowed then
|
|
531
|
+
for _, mid in ipairs(found) do
|
|
532
|
+
if not emitted[mid] then emitted[mid] = true; result[#result + 1] = mid end
|
|
533
|
+
end
|
|
534
|
+
break
|
|
535
|
+
end
|
|
385
536
|
end
|
|
386
537
|
end
|
|
387
538
|
return result
|
|
@@ -414,7 +565,9 @@ function M.binding(G, f, src, name, ctx, options)
|
|
|
414
565
|
local index = options.evidence and tonumber(options.evidence:match('^receiver:(%d+)$'))
|
|
415
566
|
local b = index == 0 and { blocked = true } or index and meta and meta.bindings[index]
|
|
416
567
|
or options.offset and M.at(meta, name, options.offset)
|
|
417
|
-
if b and (index or b.blocked or b.owner or b.type or language == 'python' or name == 'this') then
|
|
568
|
+
if b and (index or b.blocked or b.empty or b.owner or b.type or b.alternatives or language == 'python' or name == 'this') then
|
|
569
|
+
return from_binding(G, f, b, ctx)
|
|
570
|
+
end
|
|
418
571
|
if js(language) and (name == 'this' or name == 'super') or language == 'python' and (name == 'self' or name == 'cls') then
|
|
419
572
|
return { kind = 'types', ids = {}, language = language, file = f }
|
|
420
573
|
end
|
|
@@ -38,7 +38,8 @@ local function block_matches(T)
|
|
|
38
38
|
for i = 1, T.n do
|
|
39
39
|
if T.k[i] == 'kw' then
|
|
40
40
|
local t = T:text(i)
|
|
41
|
-
|
|
41
|
+
-- Lua dialect annotations can use the keyword as a type (`cb:function`).
|
|
42
|
+
if OPENS[t] and (t ~= 'function' or not is(T, i - 1, ':')) then
|
|
42
43
|
stack[#stack + 1] = i
|
|
43
44
|
elseif t == 'end' or t == 'until' then
|
|
44
45
|
local top = stack[#stack]
|
|
@@ -119,7 +120,7 @@ function M.parse(path, src, language, opts)
|
|
|
119
120
|
|
|
120
121
|
for i = 1, T.n do
|
|
121
122
|
local k = T.k[i]
|
|
122
|
-
if k == 'kw' and T:text(i) == 'function' then
|
|
123
|
+
if k == 'kw' and T:text(i) == 'function' and not is(T, i - 1, ':') then
|
|
123
124
|
local close = bm[i] or T.n
|
|
124
125
|
local parent = parent_at(i)
|
|
125
126
|
local name, qualified, kind, start, name_tok
|
|
@@ -681,7 +681,9 @@ function Completion:module_members(files, module_name)
|
|
|
681
681
|
local ids = self.V.id_of[g]
|
|
682
682
|
for n, node in ipairs(rec.nodes) do
|
|
683
683
|
if node.name == exported and not node.parent then
|
|
684
|
-
for _, entry in ipairs(self:members({ ids[n] })) do
|
|
684
|
+
for _, entry in ipairs(self:members({ ids[n] })) do
|
|
685
|
+
if entry.file == g or not node['local'] then out[#out + 1] = entry end
|
|
686
|
+
end
|
|
685
687
|
break
|
|
686
688
|
end
|
|
687
689
|
end
|
|
@@ -865,6 +867,14 @@ function Completion:entries(target)
|
|
|
865
867
|
if target.csharp_namespace ~= nil then
|
|
866
868
|
return require('codeoutline.analysis.csharp.csharp_bindings').namespace_members(self.V, self.f, target.csharp_namespace, self.V.js_context)
|
|
867
869
|
end
|
|
870
|
+
if target.alternatives then
|
|
871
|
+
local out = {}
|
|
872
|
+
for _, alternative in ipairs(target.alternatives) do
|
|
873
|
+
if self:expired() then break end
|
|
874
|
+
for _, entry in ipairs(self:module_members(alternative.modules, alternative.module_name)) do out[#out + 1] = entry end
|
|
875
|
+
end
|
|
876
|
+
return out
|
|
877
|
+
end
|
|
868
878
|
if target.modules then return self:module_members(target.modules, target.module_name) end
|
|
869
879
|
if target.owner then
|
|
870
880
|
local out = target.local_only and {} or self:owned(target.owner, graph.family(self.language))
|
|
@@ -6,30 +6,23 @@ local callable = { ['function'] = true, prototype = true, method = true, constru
|
|
|
6
6
|
local types = { class = true, struct = true, union = true, interface = true, record = true,
|
|
7
7
|
enum = true, typedef = true }
|
|
8
8
|
local values = { variable = true, constant = true, field = true, enum_member = true }
|
|
9
|
-
local reasons = { ['no indexed target'] = true, ['no eligible target'] = true,
|
|
10
|
-
['unresolved c++ name'] = true, ['name/locality match'] = true,
|
|
11
|
-
['multiple name/locality candidates'] = true }
|
|
12
9
|
local function normalized(name) return (name:gsub('::', '.'):gsub(':', '.'):gsub('^%.', '')) end
|
|
13
10
|
|
|
11
|
+
-- An empty answer leaves the editor and the agent nothing to inspect, so a
|
|
12
|
+
-- failed binding still gets name-based suggestions. They remain unconfirmed
|
|
13
|
+
-- candidates: never call edges, references or index data.
|
|
14
14
|
function M.allowed(site)
|
|
15
15
|
if not site or site.decl or not site.name or not site.name:match('^[%a_$][%w_$]*$') then return false end
|
|
16
|
-
--
|
|
17
|
-
--
|
|
18
|
-
--
|
|
19
|
-
--
|
|
20
|
-
|
|
21
|
-
and (site.macro_state == 'uncertain' or site.macro_state == 'limited')
|
|
22
|
-
if not macro_unknown and not reasons[site.reason]
|
|
23
|
-
and not (site.reason or ''):match('^ambiguous name candidates') then return false end
|
|
24
|
-
-- A known binding that failed is a barrier, not permission to guess another
|
|
25
|
-
-- imported value, local, receiver type, package, or constructor.
|
|
26
|
-
if site.evidence ~= nil and site.evidence ~= ''
|
|
27
|
-
and not (type(site.evidence) == 'string' and site.evidence:match('^cpp:name:')) then return false end
|
|
16
|
+
-- A table literal declared in this file is a bound receiver, not a failed
|
|
17
|
+
-- one: its whole contents are visible, so another file's member is a
|
|
18
|
+
-- different object. A module binding stays eligible because members can be
|
|
19
|
+
-- attached to it from other files.
|
|
20
|
+
if type(site.evidence) == 'string' and site.evidence:match('^lua%-local:') then return false end
|
|
28
21
|
return site.kind == 'call' or site.kind == 'ref' or site.kind == 'symbol' or site.kind == 'new'
|
|
29
22
|
or site.kind == 'member_call' or site.kind == 'member_symbol'
|
|
30
23
|
end
|
|
31
24
|
|
|
32
|
-
function M.find(G, f, site, ctx, lua_self)
|
|
25
|
+
function M.find(G, f, site, ctx, lua_self, lua_initializers)
|
|
33
26
|
local info = { truncated = site and site.macro_state == 'limited' or false,
|
|
34
27
|
scanned = 0, reason = 'exact name; binding unconfirmed' }
|
|
35
28
|
if not lua_self and not M.allowed(site) then return {}, info end
|
|
@@ -49,52 +42,75 @@ function M.find(G, f, site, ctx, lua_self)
|
|
|
49
42
|
qualified = qualified or normalized(site.recv .. '.' .. site.name)
|
|
50
43
|
elseif site.kind == 'member_call' or site.kind == 'member_symbol' then return {}, info end
|
|
51
44
|
end
|
|
52
|
-
local list
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
local
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
local published = language == 'lua' and require('codeoutline.analysis.lua.lua_bindings').exported(node, site.name, G.lua_global_export_tables)
|
|
62
|
-
local kind = site.kind == 'new' and types[node.kind]
|
|
63
|
-
or site.kind ~= 'new' and (callable[node.kind]
|
|
64
|
-
or (site.kind == 'symbol' or site.kind == 'member_symbol') and (types[node.kind] or values[node.kind]))
|
|
65
|
-
-- Unresolved macro visibility can still offer unconfirmed definition
|
|
66
|
-
-- tags for navigation, including when include paths are configured.
|
|
67
|
-
-- An explicit undef remains a barrier.
|
|
68
|
-
if node.kind == 'macro' then
|
|
69
|
-
kind = site.kind == 'call' and (site.macro_state == 'unseen'
|
|
70
|
-
or site.macro_state == 'uncertain' or site.macro_state == 'limited')
|
|
71
|
-
and (g ~= f or site.line and node.line < site.line)
|
|
45
|
+
local list = G.by_name[site.name] or {}
|
|
46
|
+
-- A Lua member alias is only reachable through its dotted name; its bare
|
|
47
|
+
-- key stays unpublished unless the owner is a configured export table.
|
|
48
|
+
local dotted = language == 'lua' and qualified and G.by_name[qualified]
|
|
49
|
+
if dotted and dotted ~= list then
|
|
50
|
+
local merged, seen = {}, {}
|
|
51
|
+
for _, id in ipairs(list) do merged[#merged + 1], seen[id] = id, true end
|
|
52
|
+
for _, id in ipairs(dotted) do
|
|
53
|
+
if not seen[id] then merged[#merged + 1], seen[id] = id, true end
|
|
72
54
|
end
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
list = merged
|
|
56
|
+
end
|
|
57
|
+
local source_dir = G.files[f].path:match('^(.*)/') or ''
|
|
58
|
+
-- `bare` drops the receiver qualifier: the member name alone still names a
|
|
59
|
+
-- definition worth offering, including top-level method definitions.
|
|
60
|
+
local function scan(qualifier, bare)
|
|
61
|
+
local hits, macro_hits, scanned = {}, {}, 0
|
|
62
|
+
for i = 1, math.min(#list, M.MAX_SCAN) do
|
|
63
|
+
if i % 16 == 0 then control.check() end
|
|
64
|
+
scanned = i
|
|
65
|
+
local id = list[i]
|
|
66
|
+
local node, g = G.nodes[id], G.node_file[id]
|
|
67
|
+
local rec = G.files[g]
|
|
68
|
+
local parent = node.parent and rec.nodes[node.parent]
|
|
69
|
+
local published = language == 'lua' and require('codeoutline.analysis.lua.lua_bindings').exported(node, site.name, G.lua_global_export_tables)
|
|
70
|
+
local kind = site.kind == 'new' and types[node.kind]
|
|
71
|
+
or site.kind ~= 'new' and (callable[node.kind]
|
|
72
|
+
or (site.kind == 'symbol' or site.kind == 'member_symbol') and (types[node.kind] or values[node.kind]))
|
|
73
|
+
-- Unresolved macro visibility can still offer unconfirmed definition
|
|
74
|
+
-- tags for navigation, including when include paths are configured.
|
|
75
|
+
-- An explicit undef remains a barrier.
|
|
76
|
+
if node.kind == 'macro' then
|
|
77
|
+
kind = site.kind == 'call' and (site.macro_state == 'unseen'
|
|
78
|
+
or site.macro_state == 'uncertain' or site.macro_state == 'limited')
|
|
79
|
+
and (g ~= f or site.line and node.line < site.line)
|
|
80
|
+
end
|
|
81
|
+
local name_matches = node.name == site.name or published
|
|
82
|
+
if not bare then name_matches = name_matches and (normalized(node.qualified) == site.name or published) end
|
|
83
|
+
local aliased = language == 'lua' and require('codeoutline.analysis.lua.lua_bindings').member_alias(node, qualifier)
|
|
84
|
+
if qualifier then name_matches = normalized(node.qualified) == qualifier or aliased end
|
|
85
|
+
-- No call sites, private locals, nested functions or unrelated class
|
|
86
|
+
-- methods. A class-nested member stays excluded even in the bare
|
|
87
|
+
-- pass, so an unbound C++ receiver cannot reach another class.
|
|
88
|
+
-- A lexical self can inherit through runtime metatables. The editor
|
|
89
|
+
-- can offer method definition tags even without a receiver binding.
|
|
90
|
+
local lua_method = lua_self and rec.language == 'lua' and node.name == site.name and not parent
|
|
91
|
+
and not graph.is_decl(node) and (node.kind == 'method' or node.kind == 'function' and graph.owner(node.qualified))
|
|
92
|
+
local initialized_member = lua_initializers and language == 'lua' and rec.language == 'lua' and site.recv and parent
|
|
93
|
+
and callable[parent.kind] and (node.kind == 'function' or node.kind == 'method')
|
|
94
|
+
and graph.owner(parent.qualified) == site.recv and normalized(node.qualified) == qualifier
|
|
95
|
+
if lua_method or not lua_self and kind and name_matches and graph.family(rec.language) == graph.family(language)
|
|
96
|
+
and (not node['local'] or published or aliased) and not (node.static and g ~= f)
|
|
97
|
+
and (not parent or parent.kind == 'namespace' or qualifier and types[parent.kind] or initialized_member)
|
|
98
|
+
and (qualifier or bare or node.kind ~= 'method' and node.kind ~= 'constructor') then
|
|
99
|
+
local score = g == f and 100 or (rec.path:match('^(.*)/') or '') == source_dir and 20 or 0
|
|
100
|
+
if node.kind ~= 'prototype' and not node.decl then score = score + 1 end
|
|
101
|
+
local bucket = node.kind == 'macro' and macro_hits or hits
|
|
102
|
+
bucket[#bucket + 1] = { id = id, score = score }
|
|
80
103
|
end
|
|
81
104
|
end
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
and (not node['local'] or published) and not (node.static and g ~= f)
|
|
90
|
-
and (not parent or parent.kind == 'namespace' or qualified and (types[parent.kind]))
|
|
91
|
-
and (qualified or node.kind ~= 'method' and node.kind ~= 'constructor') then
|
|
92
|
-
local score = g == f and 100 or (rec.path:match('^(.*)/') or '') == source_dir and 20 or 0
|
|
93
|
-
if node.kind ~= 'prototype' and not node.decl then score = score + 1 end
|
|
94
|
-
local bucket = node.kind == 'macro' and macro_hits or hits
|
|
95
|
-
bucket[#bucket + 1] = { id = id, score = score }
|
|
96
|
-
end
|
|
105
|
+
return hits, macro_hits, scanned
|
|
106
|
+
end
|
|
107
|
+
local hits, macro_hits, scanned = scan(qualified, false)
|
|
108
|
+
-- An unbound receiver still names a member. Offer the bare name instead of
|
|
109
|
+
-- an empty answer, keeping the qualified match authoritative when it hits.
|
|
110
|
+
if #hits == 0 and #macro_hits == 0 and qualified and not lua_self then
|
|
111
|
+
hits, macro_hits, scanned = scan(nil, true)
|
|
97
112
|
end
|
|
113
|
+
info.scanned = scanned
|
|
98
114
|
-- Ordinary definitions are more useful than unrelated proxy macros.
|
|
99
115
|
if #hits == 0 then hits = macro_hits
|
|
100
116
|
elseif configured then hits = {} end
|
|
@@ -128,6 +128,10 @@ local function view(session, root, include_paths, only)
|
|
|
128
128
|
added[alias] = added[alias] or {}
|
|
129
129
|
added[alias][#added[alias] + 1] = id
|
|
130
130
|
end
|
|
131
|
+
for _, alias in ipairs(require('codeoutline.analysis.lua.lua_bindings').member_aliases(node)) do
|
|
132
|
+
added[alias] = added[alias] or {}
|
|
133
|
+
added[alias][#added[alias] + 1] = id
|
|
134
|
+
end
|
|
131
135
|
end
|
|
132
136
|
return f
|
|
133
137
|
end
|
|
@@ -1187,6 +1191,33 @@ end
|
|
|
1187
1191
|
|
|
1188
1192
|
local handlers = {}
|
|
1189
1193
|
|
|
1194
|
+
local function lua_self_member(V, f, c)
|
|
1195
|
+
return c and c.recv == 'self' and V.files[f].language == 'lua'
|
|
1196
|
+
and (c.kind == 'member_call' or c.kind == 'member_symbol')
|
|
1197
|
+
end
|
|
1198
|
+
|
|
1199
|
+
local function definition_tags(V, f, c)
|
|
1200
|
+
local self_fallback = lua_self_member(V, f, c) and c.evidence and c.evidence:match('^lua%-self:%d+$')
|
|
1201
|
+
local ids, info = require('codeoutline.query.definition_candidates').find(V, f, c, V.js_context, self_fallback, true)
|
|
1202
|
+
local result, seen, bytes, started, count = {}, {}, 0, os.clock(), 0
|
|
1203
|
+
for _, id in ipairs(ids) do
|
|
1204
|
+
local g = V.node_file[id]
|
|
1205
|
+
local size = V.files[g].size or 0
|
|
1206
|
+
if not seen[g] then
|
|
1207
|
+
if count >= 4 or size > M.MAX_FILE_BYTES or bytes + size > 2 * M.MAX_FILE_BYTES
|
|
1208
|
+
or os.clock() - started >= 0.5 then info.truncated = true; break end
|
|
1209
|
+
seen[g], bytes, count = true, bytes + size, count + 1
|
|
1210
|
+
end
|
|
1211
|
+
local _, hit = locate(V, id)
|
|
1212
|
+
if hit and hit.parent and V.files[g].language == 'lua' then
|
|
1213
|
+
local _, tokens = M.full(V, g)
|
|
1214
|
+
if not tokens or require('codeoutline.analysis.lua.lua_bindings').has_local_receiver(tokens, c.recv, hit.start_byte) then hit = nil end
|
|
1215
|
+
end
|
|
1216
|
+
if hit then result[#result + 1] = id end
|
|
1217
|
+
end
|
|
1218
|
+
return result, info.truncated
|
|
1219
|
+
end
|
|
1220
|
+
|
|
1190
1221
|
-- Best-effort idle work: share the exact caches used by navigation, rather
|
|
1191
1222
|
-- than retaining answers that could outlive a document/configuration change.
|
|
1192
1223
|
function handlers.lsp_warm(req)
|
|
@@ -1269,8 +1300,7 @@ function handlers.lsp_definition(req)
|
|
|
1269
1300
|
end
|
|
1270
1301
|
-- Selecting a loader's member asks for that value, not the imported file.
|
|
1271
1302
|
if #targets == 0 and c and type(c.evidence) == 'string' and c.evidence:match('^lua%-value:') then return {} end
|
|
1272
|
-
local lua_self =
|
|
1273
|
-
and (c.kind == 'member_call' or c.kind == 'member_symbol')
|
|
1303
|
+
local lua_self = lua_self_member(V, f, c)
|
|
1274
1304
|
local importer = false
|
|
1275
1305
|
if c and not c.decl and not lua_self then
|
|
1276
1306
|
-- `require`/`dofile` themselves name the file they load, not a same-named project function.
|
|
@@ -1297,22 +1327,10 @@ function handlers.lsp_definition(req)
|
|
|
1297
1327
|
return result, info.truncated
|
|
1298
1328
|
end
|
|
1299
1329
|
end
|
|
1300
|
-
local
|
|
1301
|
-
local
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
for _, id in ipairs(ids) do
|
|
1305
|
-
local g = V.node_file[id]
|
|
1306
|
-
local size = V.files[g].size or 0
|
|
1307
|
-
if not seen[g] then
|
|
1308
|
-
if count >= 4 or size > M.MAX_FILE_BYTES or bytes + size > 2 * M.MAX_FILE_BYTES
|
|
1309
|
-
or os.clock() - started >= 0.5 then info.truncated = true; break end
|
|
1310
|
-
seen[g], bytes, count = true, bytes + size, count + 1
|
|
1311
|
-
end
|
|
1312
|
-
local target_doc, hit = locate(V, id)
|
|
1313
|
-
if hit then result[#result + 1] = { uri = target_doc.uri, range = target_doc:range(hit.name_start, hit.name_end) } end
|
|
1314
|
-
end
|
|
1315
|
-
return result, info.truncated or V.js_context.include_incomplete or V.js_context.workspace_incomplete
|
|
1330
|
+
local ids, truncated = definition_tags(V, f, c)
|
|
1331
|
+
local result = {}
|
|
1332
|
+
for _, id in ipairs(ids) do result[#result + 1] = (location(V, id)) end
|
|
1333
|
+
return result, truncated or V.js_context.include_incomplete or V.js_context.workspace_incomplete
|
|
1316
1334
|
or V.js_context.go_incomplete or V.js_context.go_methods_incomplete or V.js_context.cpp_receivers_incomplete or V.js_context.rust_incomplete or V.js_context.receiver_incomplete
|
|
1317
1335
|
end
|
|
1318
1336
|
if c.decl and is_decl(V.nodes[targets[1]]) then
|
|
@@ -1468,7 +1486,7 @@ function handlers.lsp_signature(req)
|
|
|
1468
1486
|
if i % 128 == 0 then control.check() end
|
|
1469
1487
|
if language == 'lua' and T.k[i] == 'kw' then
|
|
1470
1488
|
local s = T:text(i)
|
|
1471
|
-
if lua_blocks[s] then
|
|
1489
|
+
if lua_blocks[s] and (s ~= 'function' or T:text(i - 1) ~= ':') then
|
|
1472
1490
|
stack[#stack + 1] = { token = i, delimiter = s, block = true, argument = 0 }
|
|
1473
1491
|
elseif s == 'end' or s == 'until' then
|
|
1474
1492
|
while #stack > 0 do if table.remove(stack).block then break end end
|
|
@@ -1512,6 +1530,7 @@ function handlers.lsp_signature(req)
|
|
|
1512
1530
|
query.position = doc:position(T.s[name_token] - 1)
|
|
1513
1531
|
local V, _, c, targets, f = at(query)
|
|
1514
1532
|
if not V or not c or c.decl then return false end
|
|
1533
|
+
if #targets == 0 and language == 'lua' then targets = definition_tags(V, f, c) end
|
|
1515
1534
|
local signatures, seen = {}, {}
|
|
1516
1535
|
local function add_signature(node, label, uri, foreign, id)
|
|
1517
1536
|
if foreign and not seen[foreign.label] then
|
|
@@ -1568,8 +1587,11 @@ function handlers.lsp_signature(req)
|
|
|
1568
1587
|
end
|
|
1569
1588
|
|
|
1570
1589
|
function handlers.lsp_hover(req)
|
|
1571
|
-
local V, doc, c, targets = at(req)
|
|
1572
|
-
if not V
|
|
1590
|
+
local V, doc, c, targets, f = at(req)
|
|
1591
|
+
if not V then return false end
|
|
1592
|
+
local fallback = #targets == 0 and V.files[f].language == 'lua'
|
|
1593
|
+
if fallback then targets = definition_tags(V, f, c) end
|
|
1594
|
+
if #targets == 0 then return false end
|
|
1573
1595
|
local parts = {}
|
|
1574
1596
|
for k, id in ipairs(targets) do
|
|
1575
1597
|
if k > M.MAX_HOVER then break end
|
|
@@ -1579,7 +1601,8 @@ function handlers.lsp_hover(req)
|
|
|
1579
1601
|
.. (foreign and foreign.label or M.detail(V, V.node_file[id], node).sig or node.qualified) .. '\n```'
|
|
1580
1602
|
local documentation = definition_documentation(V, id)
|
|
1581
1603
|
if documentation then parts[#parts + 1] = documentation.value end
|
|
1582
|
-
parts[#parts + 1] =
|
|
1604
|
+
parts[#parts + 1] = (fallback and 'Definition candidate · ' or '')
|
|
1605
|
+
.. node.kind .. ' `' .. node.qualified .. '` — ' .. rec.path .. ':' .. node.line
|
|
1583
1606
|
end
|
|
1584
1607
|
return { contents = { kind = 'markdown', value = table.concat(parts, '\n\n') }, range = doc:range(c.first, c.last) }
|
|
1585
1608
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
return
|
|
1
|
+
return 27
|
|
@@ -1 +1 @@
|
|
|
1
|
-
return '0.3.
|
|
1
|
+
return '0.3.8'
|