forked from VimPlug/jedi-vim
Compare commits
765 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
338af171ea | ||
|
|
c0c01ede07 | ||
|
|
42c2af1812 | ||
|
|
1198e4cfa3 | ||
|
|
c5d5d2e3b4 | ||
|
|
0d245f3287 | ||
|
|
be483a2dcb | ||
|
|
f286f9e4b6 | ||
|
|
e073385976 | ||
|
|
6b8013c480 | ||
|
|
c381156dd4 | ||
|
|
28a6765ecc | ||
|
|
df261c0a3e | ||
|
|
40c7f6d09d | ||
|
|
8c7161f4e9 | ||
|
|
27db7160a5 | ||
|
|
e82d07faa1 | ||
|
|
50dfac448a | ||
|
|
0a27795d76 | ||
|
|
32d05f7742 | ||
|
|
873ee9325d | ||
|
|
08ad42efed | ||
|
|
f5aad68bec | ||
|
|
2c99d7377f | ||
|
|
7d2fc14f4f | ||
|
|
e1afc904e4 | ||
|
|
64c92771be | ||
|
|
030211555d | ||
|
|
ab2550ef29 | ||
|
|
7ac81cb880 | ||
|
|
6812ce11b7 | ||
|
|
81002ed6e7 | ||
|
|
81e1e9ca34 | ||
|
|
8763462331 | ||
|
|
760120240f | ||
|
|
6e6738758f | ||
|
|
ff9a0afbda | ||
|
|
088469a8ee | ||
|
|
8730095b89 | ||
|
|
5d4615707f | ||
|
|
960eaa8053 | ||
|
|
acd9182131 | ||
|
|
04c708cbfc | ||
|
|
91312f1755 | ||
|
|
e02fa9dc10 | ||
|
|
d7be014c54 | ||
|
|
e96eba9f53 | ||
|
|
e4daf7a74c | ||
|
|
3a1c900a26 | ||
|
|
57757bd334 | ||
|
|
ea52ca5305 | ||
|
|
04ba9a2430 | ||
|
|
dc0fdc55cb | ||
|
|
a76965238a | ||
|
|
6193c9fd95 | ||
|
|
acbb712906 | ||
|
|
48b3e5c0e7 | ||
|
|
74fd73d017 | ||
|
|
6efd966481 | ||
|
|
862fbbc8a9 | ||
|
|
87abaf0781 | ||
|
|
01e6e6bcf7 | ||
|
|
2c157e323e | ||
|
|
6edda9063a | ||
|
|
e23687462b | ||
|
|
104d817f0c | ||
|
|
2949389be4 | ||
|
|
c4fc2cde8c | ||
|
|
5858a999de | ||
|
|
1e9bdc863a | ||
|
|
3a27747773 | ||
|
|
4ca918e830 | ||
|
|
a17b033303 | ||
|
|
a0207fadf9 | ||
|
|
e83112f9aa | ||
|
|
b2e8c65e35 | ||
|
|
686f39ac00 | ||
|
|
055199f2aa | ||
|
|
8d24b83754 | ||
|
|
a3696bee36 | ||
|
|
5d4658f989 | ||
|
|
18b1a519b0 | ||
|
|
acb98fc706 | ||
|
|
e99cfd32de | ||
|
|
41ecaa5c15 | ||
|
|
5dd5631027 | ||
|
|
b689409a2a | ||
|
|
ea4de13344 | ||
|
|
1f7bc2a0fb | ||
|
|
c9bdefca54 | ||
|
|
e8790b1d8f | ||
|
|
e2abec21c5 | ||
|
|
c0ded0baf2 | ||
|
|
7dfc56992a | ||
|
|
2572136fcb | ||
|
|
55120b28e4 | ||
|
|
d57edde2e8 | ||
|
|
fab26f4551 | ||
|
|
4dcc6437e3 | ||
|
|
c80a08d983 | ||
|
|
ac6b2f1e3e | ||
|
|
12e97c7a04 | ||
|
|
08f13af066 | ||
|
|
5880f2de93 | ||
|
|
b4b2f3ef54 | ||
|
|
50abb5e95a | ||
|
|
89c995e7d9 | ||
|
|
4f2499e4f2 | ||
|
|
7665d73eae | ||
|
|
b3d715c5fc | ||
|
|
b9f8317595 | ||
|
|
d3f40d13ec | ||
|
|
016fb7c78e | ||
|
|
e736eea934 | ||
|
|
6c6b4dcf92 | ||
|
|
73289427ba | ||
|
|
1a053d2a23 | ||
|
|
636ad08d32 | ||
|
|
d32962f3b2 | ||
|
|
717446dd71 | ||
|
|
9c9a513aaf | ||
|
|
69aa410afa | ||
|
|
914754a04e | ||
|
|
f26b2a8802 | ||
|
|
d879d2f216 | ||
|
|
23c14f6826 | ||
|
|
1f7e661d9d | ||
|
|
c6fe4fee76 | ||
|
|
ea5e87a703 | ||
|
|
d02a72e792 | ||
|
|
42d24387ac | ||
|
|
ba5915bf26 | ||
|
|
c5c13d69d6 | ||
|
|
f36749776d | ||
|
|
7f4f2db260 | ||
|
|
2f65c636f8 | ||
|
|
b6dfc5fd49 | ||
|
|
2a43448f3b | ||
|
|
c6f05cd82c | ||
|
|
132d8506ab | ||
|
|
399c57ff72 | ||
|
|
1126ffde9b | ||
|
|
88502891ba | ||
|
|
b33392c8c8 | ||
|
|
ffec4d7fc5 | ||
|
|
43a9a9b191 | ||
|
|
e05f34646e | ||
|
|
713e78dd39 | ||
|
|
e49638ffc8 | ||
|
|
4c430ed536 | ||
|
|
40fc5ab27f | ||
|
|
9a4a4f4074 | ||
|
|
c6716c6392 | ||
|
|
5123dbbbc7 | ||
|
|
ee0f759a2e | ||
|
|
66b6a20041 | ||
|
|
8e077adb2f | ||
|
|
e7cb9a186e | ||
|
|
b5774a9554 | ||
|
|
f0d80048f1 | ||
|
|
9e2244c44e | ||
|
|
cc087ef463 | ||
|
|
efaef9cee3 | ||
|
|
58561d45f1 | ||
|
|
84b8eeb954 | ||
|
|
2bb7677b43 | ||
|
|
81ada14f0b | ||
|
|
7cade1fb62 | ||
|
|
1773837a11 | ||
|
|
67fd8c6572 | ||
|
|
d3d9a91ae6 | ||
|
|
0361d6c633 | ||
|
|
a54729ef63 | ||
|
|
5f98bfb62e | ||
|
|
745dc8a559 | ||
|
|
84a5299c8f | ||
|
|
d4006ab1bf | ||
|
|
ed8153ef2b | ||
|
|
f07ff6a535 | ||
|
|
6781eb17da | ||
|
|
5ad782d920 | ||
|
|
d75aaa470e | ||
|
|
56eb0f6d63 | ||
|
|
835e329883 | ||
|
|
49fa267e59 | ||
|
|
fa1aaa10cf | ||
|
|
e54a17ec71 | ||
|
|
48a9ea085d | ||
|
|
72a2643f7c | ||
|
|
57cbf1421f | ||
|
|
7894b38c0c | ||
|
|
1c3078e9f9 | ||
|
|
79b332a3c6 | ||
|
|
24a0369d0f | ||
|
|
d430570fd0 | ||
|
|
79c6172be7 | ||
|
|
48af2afd3e | ||
|
|
7b7e6b5859 | ||
|
|
37bd03c3d5 | ||
|
|
79ced22a37 | ||
|
|
510b1c94e4 | ||
|
|
6d05c25873 | ||
|
|
0b9bbc3495 | ||
|
|
31ebd30c31 | ||
|
|
3be8833913 | ||
|
|
77924398bd | ||
|
|
8e0cefc371 | ||
|
|
bbd456c016 | ||
|
|
41507bab99 | ||
|
|
8b7c4cbad5 | ||
|
|
65190a1856 | ||
|
|
fb52e32238 | ||
|
|
109ceeb2f8 | ||
|
|
d189d8aab7 | ||
|
|
7e6811cb4b | ||
|
|
24496c1416 | ||
|
|
8d547695e2 | ||
|
|
d42f56bc82 | ||
|
|
192e03b335 | ||
|
|
1c7c9064b7 | ||
|
|
85020495ef | ||
|
|
edde267f6b | ||
|
|
641c88111d | ||
|
|
5c6531ffae | ||
|
|
516189c7e3 | ||
|
|
ce6b60063d | ||
|
|
72c1a332d2 | ||
|
|
c8164fdfda | ||
|
|
0c6a2b7737 | ||
|
|
60bdff8eea | ||
|
|
ddaec5652b | ||
|
|
163a0b5db1 | ||
|
|
cfadac7f22 | ||
|
|
82661d515b | ||
|
|
a46ea1a1eb | ||
|
|
a2cf2291da | ||
|
|
dc7b6228b2 | ||
|
|
20312dcca8 | ||
|
|
c11b38cb48 | ||
|
|
f1d9708f7c | ||
|
|
6394614017 | ||
|
|
6411de0cd1 | ||
|
|
0ee2ed0bc6 | ||
|
|
e2d79c6434 | ||
|
|
53358dc0fa | ||
|
|
18af876d6b | ||
|
|
40a02a7fd1 | ||
|
|
eef60e056a | ||
|
|
8e34a59045 | ||
|
|
c1e279cab7 | ||
|
|
2ee9ec64d3 | ||
|
|
682f37792d | ||
|
|
0844b14866 | ||
|
|
ac6756a466 | ||
|
|
b885e10e0d | ||
|
|
0dea756fd9 | ||
|
|
8cf616b088 | ||
|
|
63ecc1dbd7 | ||
|
|
52772e171f | ||
|
|
eba90e615d | ||
|
|
f100ffad4d | ||
|
|
702da51cbe | ||
|
|
fe30fa485b | ||
|
|
3582fa6bc2 | ||
|
|
4a3dc9da84 | ||
|
|
f99d86073b | ||
|
|
636d393114 | ||
|
|
4baf4b27f7 | ||
|
|
3dc61513af | ||
|
|
80378d857b | ||
|
|
671f9f5780 | ||
|
|
b96dad9d50 | ||
|
|
a69e6b8cc0 | ||
|
|
f191ccd6fb | ||
|
|
8243015479 | ||
|
|
01787a9988 | ||
|
|
4ed33a8600 | ||
|
|
e66c2e12e6 | ||
|
|
d0c3ddb9ff | ||
|
|
12db7ad364 | ||
|
|
9384d464ec | ||
|
|
d86039ea89 | ||
|
|
b32b731767 | ||
|
|
6a6595f5c5 | ||
|
|
026ae6be03 | ||
|
|
b7163d615c | ||
|
|
443e7fe555 | ||
|
|
b3f7f3c0b5 | ||
|
|
8753bf2e16 | ||
|
|
f95ac1e8e0 | ||
|
|
f0c63f1172 | ||
|
|
02c2de1c51 | ||
|
|
99132ec545 | ||
|
|
5ea9ee7a63 | ||
|
|
ba0b44b65d | ||
|
|
369284a6bc | ||
|
|
3882c5dd32 | ||
|
|
c94a143bfb | ||
|
|
b7e42e6ad5 | ||
|
|
2eabe57616 | ||
|
|
d9f92d5b24 | ||
|
|
6b7dfe1c1a | ||
|
|
70360437cd | ||
|
|
19ad3063d9 | ||
|
|
8334e505b3 | ||
|
|
e8b88f0161 | ||
|
|
a0c3269420 | ||
|
|
75e9141111 | ||
|
|
5ccdd11282 | ||
|
|
5bcb17a8ad | ||
|
|
0f7b743b4e | ||
|
|
48ad42de86 | ||
|
|
0d613b5cf9 | ||
|
|
794af5b90a | ||
|
|
221d7dbee4 | ||
|
|
e7193b5e5f | ||
|
|
9ae6da6467 | ||
|
|
f08abefa31 | ||
|
|
cdfb7a5b4f | ||
|
|
de793216f5 | ||
|
|
6b8d900b05 | ||
|
|
df39189578 | ||
|
|
625c568b12 | ||
|
|
8215b220f9 | ||
|
|
dc23f0b859 | ||
|
|
217e56d9bd | ||
|
|
0c2831d9a6 | ||
|
|
b3e91e8de2 | ||
|
|
13a4a0c0c4 | ||
|
|
2cf1d42fff | ||
|
|
84f5cd92c7 | ||
|
|
9af06424fb | ||
|
|
4b32847110 | ||
|
|
a5be01fb0b | ||
|
|
267df8b3da | ||
|
|
005cb5225f | ||
|
|
95d8eb1b08 | ||
|
|
431a0b11e5 | ||
|
|
9a258c74f5 | ||
|
|
5c868b9a1f | ||
|
|
62c423bf29 | ||
|
|
7abc3ad8d4 | ||
|
|
9633044332 | ||
|
|
067ab1ea4b | ||
|
|
e38981fc4f | ||
|
|
8ee4e12d3e | ||
|
|
b38ec94646 | ||
|
|
9c235c79ac | ||
|
|
8cfa121b4d | ||
|
|
c94fe6fcee | ||
|
|
5041224c13 | ||
|
|
4867831ad0 | ||
|
|
610cbcacb7 | ||
|
|
b5ec9ac3ed | ||
|
|
253eb5102c | ||
|
|
9ec2fb44b0 | ||
|
|
e241cf87fd | ||
|
|
525524b5cf | ||
|
|
267f66755d | ||
|
|
6b96313930 | ||
|
|
afc02a3621 | ||
|
|
bcf24529fa | ||
|
|
676b37812b | ||
|
|
0d52b56a72 | ||
|
|
45c0b91c5e | ||
|
|
261261af3d | ||
|
|
3f259c2a9e | ||
|
|
83e62d56ba | ||
|
|
ed09c7c1af | ||
|
|
2fbcc5b991 | ||
|
|
7890339ca8 | ||
|
|
91c2a031df | ||
|
|
0703494188 | ||
|
|
6dedbf339e | ||
|
|
889feae117 | ||
|
|
ac1615c647 | ||
|
|
d3484afe20 | ||
|
|
dc9688602c | ||
|
|
ed4a8be12e | ||
|
|
924b4db962 | ||
|
|
95b8dd77ba | ||
|
|
2e0be9069a | ||
|
|
b3978bc4aa | ||
|
|
91b4332774 | ||
|
|
133281a021 | ||
|
|
439e50e9d1 | ||
|
|
56b2268df3 | ||
|
|
a135f3b75b | ||
|
|
bce599fc9c | ||
|
|
0dd1b9fd44 | ||
|
|
6c1719a68a | ||
|
|
d79f41149f | ||
|
|
651eac91ff | ||
|
|
abc0c07d0f | ||
|
|
0747189516 | ||
|
|
dd33e38631 | ||
|
|
9a13f143a8 | ||
|
|
6025f59945 | ||
|
|
1bf69c5844 | ||
|
|
054285e2b7 | ||
|
|
fb77981040 | ||
|
|
de410d9347 | ||
|
|
299c9b26d3 | ||
|
|
4d67c1a6e3 | ||
|
|
154e2dbae3 | ||
|
|
b9ba141069 | ||
|
|
bf281dabda | ||
|
|
afb84a837c | ||
|
|
7539614f09 | ||
|
|
fc95545378 | ||
|
|
676c558110 | ||
|
|
65c06553fd | ||
|
|
4095d0efef | ||
|
|
527562208c | ||
|
|
baa2969427 | ||
|
|
dd4cb80911 | ||
|
|
e5038cc9fa | ||
|
|
2f06d90f95 | ||
|
|
03805f87f5 | ||
|
|
c38b549a95 | ||
|
|
83d398bc5d | ||
|
|
0f203c12b9 | ||
|
|
cfb76259f1 | ||
|
|
78ac52a26e | ||
|
|
3b26cf376b | ||
|
|
d76c00eff4 | ||
|
|
3c79979c50 | ||
|
|
1837cdee1f | ||
|
|
e43012afc8 | ||
|
|
2d74fe6c51 | ||
|
|
9779628322 | ||
|
|
3497a9644e | ||
|
|
0cd664d8f7 | ||
|
|
7784c29a59 | ||
|
|
8f7f07fb58 | ||
|
|
63dc0badac | ||
|
|
cc254432b6 | ||
|
|
ae8a2505bc | ||
|
|
839e1b5b85 | ||
|
|
27df21c7bf | ||
|
|
acdd711d84 | ||
|
|
9b11e70afe | ||
|
|
ab04982d63 | ||
|
|
a0bb09e891 | ||
|
|
2611ea3c27 | ||
|
|
fe517fae74 | ||
|
|
401731c98b | ||
|
|
b78f1d74c5 | ||
|
|
2bfae0acfa | ||
|
|
b7bdb5a06e | ||
|
|
a233d603e3 | ||
|
|
1005d1ad64 | ||
|
|
c22e2bcdf5 | ||
|
|
bf96f7d611 | ||
|
|
a120f428ff | ||
|
|
d3fadd54c7 | ||
|
|
d65c35a69d | ||
|
|
f714b58300 | ||
|
|
e87e7db0e9 | ||
|
|
cc9837dc23 | ||
|
|
43dcc4809f | ||
|
|
620b538f34 | ||
|
|
2ee17b3be6 | ||
|
|
69160c329a | ||
|
|
3071700635 | ||
|
|
075cd9ce69 | ||
|
|
2ba5656606 | ||
|
|
d82df60392 | ||
|
|
c9c0198467 | ||
|
|
6dcebb4644 | ||
|
|
28497ec3a9 | ||
|
|
78fc26456a | ||
|
|
55929b2713 | ||
|
|
b6bef9a056 | ||
|
|
59c98d61cf | ||
|
|
733ba775b0 | ||
|
|
b71ef1176c | ||
|
|
8016665639 | ||
|
|
bf4a8bfd5a | ||
|
|
789d06b573 | ||
|
|
9eaede84b2 | ||
|
|
18b9f08336 | ||
|
|
e3f4474dd7 | ||
|
|
c5c69f0ee1 | ||
|
|
74d51815a5 | ||
|
|
43d16b9966 | ||
|
|
2bccea9b5d | ||
|
|
05f2565dac | ||
|
|
57e476c214 | ||
|
|
48c9420136 | ||
|
|
a3210ce7b6 | ||
|
|
409da304b4 | ||
|
|
8ce612e3a6 | ||
|
|
f44ae4efe0 | ||
|
|
9ea98e2e81 | ||
|
|
fb1eaa611e | ||
|
|
e1a49790cb | ||
|
|
048b9dc286 | ||
|
|
cfd71a6b54 | ||
|
|
0ce1af78b2 | ||
|
|
3a8560ac58 | ||
|
|
6cc1d8c34a | ||
|
|
10cd4c6cfb | ||
|
|
2a6f35a91e | ||
|
|
d477ee6557 | ||
|
|
4ec0edafd8 | ||
|
|
2192f41442 | ||
|
|
8fded9837e | ||
|
|
6fabdd2fab | ||
|
|
997220d3a5 | ||
|
|
21efb8a0e8 | ||
|
|
1e0ae6bd35 | ||
|
|
b25db7ff5d | ||
|
|
a6f711fbbc | ||
|
|
12e9235bfd | ||
|
|
43eaec0aee | ||
|
|
089f9b0027 | ||
|
|
671b12da9a | ||
|
|
e620b5bf50 | ||
|
|
1792fb9e1b | ||
|
|
c32844dfec | ||
|
|
4e9aa671a7 | ||
|
|
61e1f46626 | ||
|
|
f8e5b8dbec | ||
|
|
503fe3da67 | ||
|
|
0f591e1283 | ||
|
|
21192f55f4 | ||
|
|
aa1d83cf68 | ||
|
|
feb7688d07 | ||
|
|
5e0bf55972 | ||
|
|
c9bede82b6 | ||
|
|
fa08586a94 | ||
|
|
bbe2861fa1 | ||
|
|
bb5c473633 | ||
|
|
4724e18b63 | ||
|
|
d9a43db019 | ||
|
|
ce7ba53224 | ||
|
|
154d9b8295 | ||
|
|
8f1e8f62fb | ||
|
|
ee46c28669 | ||
|
|
38f966092e | ||
|
|
99a9445acb | ||
|
|
90f0bff2de | ||
|
|
d43768c7b5 | ||
|
|
8aa53ee576 | ||
|
|
51802fa151 | ||
|
|
1388f46137 | ||
|
|
57a2cc787b | ||
|
|
b1205ce779 | ||
|
|
3ad63c9458 | ||
|
|
3d4a594519 | ||
|
|
c1ff868cb4 | ||
|
|
44b8165ba3 | ||
|
|
e324a34c69 | ||
|
|
7b8e6bd6ed | ||
|
|
485e02d3b5 | ||
|
|
17bfd3b276 | ||
|
|
0d50a1caec | ||
|
|
e8b9fcb5d1 | ||
|
|
4e0d196e92 | ||
|
|
493d89302a | ||
|
|
bd68a98848 | ||
|
|
eceba1e675 | ||
|
|
4508fc22f8 | ||
|
|
21ce925ccb | ||
|
|
04c3fc9d1b | ||
|
|
a9ffcbbda9 | ||
|
|
882c5f0611 | ||
|
|
7bf66ebab2 | ||
|
|
20a63f6c0f | ||
|
|
0ba4993d5d | ||
|
|
b8269d70d4 | ||
|
|
a247e9b1c7 | ||
|
|
aa56af0d9c | ||
|
|
b8edeef966 | ||
|
|
2a3eaeb2dc | ||
|
|
e1cac7d3f7 | ||
|
|
27d35b4fc0 | ||
|
|
df81a593ec | ||
|
|
63162524c2 | ||
|
|
ec405fa3b2 | ||
|
|
1c24594c70 | ||
|
|
45dd72b557 | ||
|
|
e31fcf8580 | ||
|
|
f082e2b75a | ||
|
|
90d2208554 | ||
|
|
dd89f6ba6b | ||
|
|
d1f8a91fd3 | ||
|
|
f405ce625a | ||
|
|
320809c211 | ||
|
|
acfbc6850b | ||
|
|
e053a78c01 | ||
|
|
7939ef7298 | ||
|
|
4672275d62 | ||
|
|
ed629d5ec1 | ||
|
|
f0c46450c9 | ||
|
|
81b752f606 | ||
|
|
d85413feaa | ||
|
|
b618e5b863 | ||
|
|
39eba902c4 | ||
|
|
02a7c89a37 | ||
|
|
c3f9f03065 | ||
|
|
fe3840770a | ||
|
|
48d0370387 | ||
|
|
dd426c6369 | ||
|
|
3934359666 | ||
|
|
8a385ffa54 | ||
|
|
d2106d73c6 | ||
|
|
36e84dd112 | ||
|
|
87ac865919 | ||
|
|
3ce655f428 | ||
|
|
111cca5106 | ||
|
|
63f159aa76 | ||
|
|
505c067c54 | ||
|
|
e534aeee4b | ||
|
|
3154c4ab08 | ||
|
|
178b064821 | ||
|
|
b9154c7353 | ||
|
|
eae610a88d | ||
|
|
c1ec986732 | ||
|
|
c7b3ad9e2c | ||
|
|
c4980738bd | ||
|
|
ed3748a9b9 | ||
|
|
a83489e62a | ||
|
|
ac754b4785 | ||
|
|
d29bd89d58 | ||
|
|
fa405c2e3d | ||
|
|
8adc9d1eda | ||
|
|
3a96300d65 | ||
|
|
45c34d5e93 | ||
|
|
7245dff650 | ||
|
|
bb4d5a6504 | ||
|
|
32a1593d10 | ||
|
|
a9c654fe48 | ||
|
|
6c9b115661 | ||
|
|
9d2259a63d | ||
|
|
11681e2aa7 | ||
|
|
6fa00cd548 | ||
|
|
429f402675 | ||
|
|
70d65d6981 | ||
|
|
3d53e26298 | ||
|
|
89208a798e | ||
|
|
5d9d48b15b | ||
|
|
6e360a4f15 | ||
|
|
1e08c815e5 | ||
|
|
4e0f5d7ab9 | ||
|
|
683257be6b | ||
|
|
bdc6a03ac2 | ||
|
|
0fe47ce214 | ||
|
|
22149611a3 | ||
|
|
8672280054 | ||
|
|
c7c266ed29 | ||
|
|
2b52548b37 | ||
|
|
bdf86d53f1 | ||
|
|
d9d5a329f0 | ||
|
|
b5b31aa0e6 | ||
|
|
dcf884a6ca | ||
|
|
c3bea09d74 | ||
|
|
3fb703f0a7 | ||
|
|
8fb8d9903c | ||
|
|
592d19f29e | ||
|
|
2991ec7d55 | ||
|
|
10bad3310d | ||
|
|
83540e66a4 | ||
|
|
eba0689bff | ||
|
|
90bdf0c106 | ||
|
|
7e116d8295 | ||
|
|
52ff4176ed | ||
|
|
53137b85a7 | ||
|
|
c6de6c3425 | ||
|
|
23d7b99f96 | ||
|
|
d1d453b891 | ||
|
|
c49b68a25d | ||
|
|
b8ff144ed5 | ||
|
|
c8c4399d45 | ||
|
|
5993b0c599 | ||
|
|
0b8448804d | ||
|
|
59be959a3d | ||
|
|
1247e258d0 | ||
|
|
100e1ed8cd | ||
|
|
63029f5ea2 | ||
|
|
c58fc7c952 | ||
|
|
748a47e6e9 | ||
|
|
a74c3bd29a | ||
|
|
6ed0b78c90 | ||
|
|
99b53f200f | ||
|
|
9f683c4cbf | ||
|
|
6ee05f976d | ||
|
|
bba9682197 | ||
|
|
00814ef58d | ||
|
|
e01eadb9ed | ||
|
|
7c1aa736ff | ||
|
|
e93976ad44 | ||
|
|
6028e0d379 | ||
|
|
cf6551f17e | ||
|
|
33b58d894c | ||
|
|
be4039995a | ||
|
|
64aeebb12b | ||
|
|
5e5d308348 | ||
|
|
ddad7b8a90 | ||
|
|
bbebff8a21 | ||
|
|
380ab946e5 | ||
|
|
ca50a02a86 | ||
|
|
26492d1d32 | ||
|
|
bf62eebca4 | ||
|
|
dbafc2c0e3 | ||
|
|
108cfbdd5d | ||
|
|
622331afa4 | ||
|
|
9c3e9dbe03 | ||
|
|
a8422d3682 | ||
|
|
6f107578ee | ||
|
|
355203cab0 | ||
|
|
e4a2a0f30e | ||
|
|
efb1997218 | ||
|
|
cf3182e549 | ||
|
|
2cc0adcc65 | ||
|
|
d56bf264e7 | ||
|
|
b9fef7b969 | ||
|
|
dd70fa0891 | ||
|
|
ccc901f360 | ||
|
|
f88c11e353 | ||
|
|
e8e1cc7d47 | ||
|
|
34bf4479d8 | ||
|
|
403028a50c | ||
|
|
3ae35c1ea1 | ||
|
|
fcc8cf5185 | ||
|
|
ab5065753e | ||
|
|
daa7f1c60c | ||
|
|
42b240c366 | ||
|
|
211cbf1fb7 | ||
|
|
001db4bfe5 | ||
|
|
422ad483c1 | ||
|
|
165dea0a2c | ||
|
|
5b1a253e9b | ||
|
|
8c482c72db | ||
|
|
354f8da568 | ||
|
|
31611335b4 | ||
|
|
a8726171bf | ||
|
|
4c0652064a | ||
|
|
0d27821064 | ||
|
|
93e49bb888 | ||
|
|
84a982ee26 | ||
|
|
4bc8a44453 | ||
|
|
e6ef96412e | ||
|
|
c1026023f2 | ||
|
|
15605d77d6 | ||
|
|
a763f12b4e | ||
|
|
d0b0413e7b | ||
|
|
7d1d5bd492 | ||
|
|
7577ddc7a7 | ||
|
|
61f457b666 | ||
|
|
f9ea25ec4e | ||
|
|
6a4d7c40ca | ||
|
|
ed8dcf6f5d | ||
|
|
c2cbe4133e | ||
|
|
1d14abfff8 | ||
|
|
fdcc192def | ||
|
|
d5ba11971b | ||
|
|
70f4c16ae3 | ||
|
|
bf7a5b82bb | ||
|
|
f2354d3700 | ||
|
|
f234bf4376 | ||
|
|
5a5c383aa6 | ||
|
|
2b0e66b565 | ||
|
|
69e4cead81 |
7
.coveragerc
Normal file
7
.coveragerc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[run]
|
||||||
|
branch = 1
|
||||||
|
# Used by/for neovim-python-client.
|
||||||
|
concurrency = greenlet
|
||||||
|
|
||||||
|
[report]
|
||||||
|
include = pythonx/jedi_*.py,test/*
|
||||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: [davidhalter]
|
||||||
44
.github/ISSUE_TEMPLATE.md
vendored
Normal file
44
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
### Issue
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please describe the issue here.
|
||||||
|
|
||||||
|
If you are not using jedi-vim from Git (but e.g. from a distribution's package,
|
||||||
|
please try it with jedi-vim's Git master, too).
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Include if relevant.
|
||||||
|
|
||||||
|
Please provide steps to reproduce it here, preferably based on a minimal Vim
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
You can use the following template (save it as `minimal.vimrc` in the directory
|
||||||
|
where jedi-vim is installed, `cd` into that directory, and run Vim with
|
||||||
|
`vim -u minimal.vimrc`):
|
||||||
|
|
||||||
|
```
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
let script_dir = fnamemodify(expand('<sfile>'), ':h')
|
||||||
|
let &runtimepath .= ','.script_dir.','.script_dir.'/after'
|
||||||
|
|
||||||
|
" Put your config changes here.
|
||||||
|
" let g:jedi#show_call_signatures=1
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
filetype plugin indent on
|
||||||
|
```
|
||||||
|
|
||||||
|
Please provide the `minimal.vimrc` you have used here, too.
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Output of “:verbose JediDebugInfo”
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please execute `:redir @+> | silent verb JediDebugInfo | redir END` in a
|
||||||
|
Python buffer to copy debug information into your clipboard.
|
||||||
|
Then paste it here.
|
||||||
|
-->
|
||||||
63
.github/workflows/ci.yml
vendored
Normal file
63
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
name: ci
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
sudo pip install pytest
|
||||||
|
vim --version
|
||||||
|
|
||||||
|
#- name: Setup tmate session
|
||||||
|
# uses: mxschmitt/action-tmate@v3
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: 'make test'
|
||||||
|
|
||||||
|
code-quality:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
vim --version
|
||||||
|
make check
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/stable -y
|
||||||
|
sudo apt-get update -q
|
||||||
|
sudo apt-get install neovim -y
|
||||||
|
|
||||||
|
sudo pip install pynvim pytest-cov
|
||||||
|
sudo pip list
|
||||||
|
nvim --version
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
make --keep-going test_coverage BUILD_VIRTUAL_ENV=$VIRTUAL_ENV
|
||||||
|
|
||||||
|
- name: Upload coverage data
|
||||||
|
run: |
|
||||||
|
coverage xml
|
||||||
|
bash <(curl -s https://codecov.io/bash) -X fix -f coverage.xml -F py${TRAVIS_PYTHON_VERSION//./}
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,2 +1,8 @@
|
|||||||
*.swp
|
*~
|
||||||
*.pyc
|
*.sw?
|
||||||
|
*.py[cod]
|
||||||
|
.ropeproject
|
||||||
|
doc/tags
|
||||||
|
.pytest-cache
|
||||||
|
build
|
||||||
|
.coverage*
|
||||||
|
|||||||
7
.gitmodules
vendored
7
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
|||||||
[submodule "jedi"]
|
[submodule "jedi"]
|
||||||
path = jedi
|
path = pythonx/jedi
|
||||||
url = git://github.com/davidhalter/jedi.git
|
url = https://github.com/davidhalter/jedi.git
|
||||||
|
[submodule "pythonx/parso"]
|
||||||
|
path = pythonx/parso
|
||||||
|
url = https://github.com/davidhalter/parso.git
|
||||||
|
|||||||
31
.travis.yml
Normal file
31
.travis.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
dist: bionic
|
||||||
|
language: python
|
||||||
|
python: 3.8
|
||||||
|
env:
|
||||||
|
- ENV=test
|
||||||
|
- ENV=check
|
||||||
|
- ENV=test_coverage
|
||||||
|
install:
|
||||||
|
- |
|
||||||
|
if [ "$ENV" = "test" ]; then
|
||||||
|
pip install pytest
|
||||||
|
elif [ "$ENV" = "test_coverage" ]; then
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/stable -y
|
||||||
|
sudo apt-get update -q
|
||||||
|
sudo apt-get install neovim -y
|
||||||
|
|
||||||
|
pip install pynvim pytest-cov
|
||||||
|
pip list
|
||||||
|
nvim --version
|
||||||
|
else
|
||||||
|
vim --version
|
||||||
|
fi
|
||||||
|
script:
|
||||||
|
- make --keep-going "$ENV" BUILD_VIRTUAL_ENV=$VIRTUAL_ENV
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
- |
|
||||||
|
if [ "$ENV" = "test_coverage" ]; then
|
||||||
|
coverage xml
|
||||||
|
travis_retry bash <(curl -s https://codecov.io/bash) -X fix -f coverage.xml -F py${TRAVIS_PYTHON_VERSION//./}
|
||||||
|
fi
|
||||||
58
AUTHORS.txt
58
AUTHORS.txt
@@ -1,11 +1,61 @@
|
|||||||
Main Authors
|
Main Authors
|
||||||
============
|
============
|
||||||
|
|
||||||
David Halter (@davidhalter)
|
David Halter (@davidhalter) <davidhalter88@gmail.com>
|
||||||
|
|
||||||
|
|
||||||
Contributors
|
Contributors (in order of contributions)
|
||||||
============
|
========================================
|
||||||
|
|
||||||
Danilo Bargen (@gwrtheyrn)
|
Patrice Peterson (@runiq)
|
||||||
tek (@tek)
|
tek (@tek)
|
||||||
|
heavenshell (@heavenshell) <heavenshell.jp@gmail.com>
|
||||||
|
Danilo Bargen (@dbrgn) <gezuru@gmail.com>
|
||||||
|
mattn (@mattn) <mattn.jp@gmail.com>
|
||||||
|
Enrico Batista da Luz (@ricobl) <rico.bl@gmail.com>
|
||||||
|
coot (@coot) <mszamot@gmail.com>
|
||||||
|
Artur Dryomov (@ming13) <artur.dryomov@gmail.com>
|
||||||
|
andviro (@andviro)
|
||||||
|
Jean-Louis Fuchs (@ganwell) <ganwell@fangorn.ch>
|
||||||
|
Mathieu Comandon (@strycore) <strider@strycore.com>
|
||||||
|
Nick Hurley (@todesschaf) <hurley@todesschaf.org>
|
||||||
|
gpoulin (@gpoulin)
|
||||||
|
Akinori Hattori (@hattya)
|
||||||
|
Luper Rouch (@flupke)
|
||||||
|
Matthew Moses (@mlmoses) <moses.matthewl@gmail.com>
|
||||||
|
Tyler Wymer (@twymer)
|
||||||
|
Artem Nezvigin (@artnez)
|
||||||
|
rogererens (@rogererens)
|
||||||
|
Emily Strickland (@emilyst) <mail@emily.st>
|
||||||
|
Tin Tvrtković (@Tinche) <tinchester@gmail.com>
|
||||||
|
Zekeriya Koc (@zekzekus) <zekzekus@gmail.com>
|
||||||
|
ethinx (@ethinx) <eth2net@gmail.com>
|
||||||
|
Wouter Overmeire (@lodagro) <lodagro@gmail.com>
|
||||||
|
Stephen J. Fuhry (@fuhrysteve) <fuhrysteve@gmail.com>
|
||||||
|
Sheng Yun (@ShengYun) <uewing@gmail.com>
|
||||||
|
Yann Thomas-Gérard (@inside) <inside@gmail.com>
|
||||||
|
Colin Su (@littleq0903) <littleq0903@gmail.com>
|
||||||
|
Arthur Jaron (@eyetracker)
|
||||||
|
Justin M. Keyes (@justinmk)
|
||||||
|
nagev (@np1)
|
||||||
|
Chris Lasher (@gotgenes) <chris.lasher@gmail.com>
|
||||||
|
Doan Thanh Nam (@tndoan)
|
||||||
|
Markus Koller (@toupeira)
|
||||||
|
Justin Cheevers @justincheevers
|
||||||
|
Talha Ahmed (@talha81) <talha.ahmed@gmail.com>
|
||||||
|
Matthew Tylee Atkinson (@matatk)
|
||||||
|
Pedro Ferrari (@petobens)
|
||||||
|
Daniel Hahler (@blueyed)
|
||||||
|
Dave Honneffer (@pearofducks)
|
||||||
|
Bagrat Aznauryan (@n9code)
|
||||||
|
Tomoyuki Kashiro (@kashiro)
|
||||||
|
Tommy Allen (@tweekmonster)
|
||||||
|
Mingliang (@Aulddays)
|
||||||
|
Brian Mego (@brianmego)
|
||||||
|
Stevan Milic (@stevanmilic) <stevan.milic@yahoo.com>
|
||||||
|
Konstantin Glukhov (@Konstantin-Glukhov)
|
||||||
|
Seungchan An (@SeungChan92) <dev.issea1015@gmail.com>
|
||||||
|
Thomas Blauth (@ThomasBlauth) <thomas.blauth@protonmail.com>
|
||||||
|
James Cherti (@jamescherti)
|
||||||
|
|
||||||
|
@something are github user names.
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
Pull Requests are great (on the **dev** branch)!
|
# We <3 pull requests!
|
||||||
|
|
||||||
1. Fork the Repo on github.
|
1. Fork the Repo on github.
|
||||||
2. If you are adding functionality or fixing a bug, please add a test!
|
2. Add yourself to AUTHORS.txt
|
||||||
3. Push to your fork and submit a **pull request to the dev branch**.
|
3. Add a test if possible.
|
||||||
|
4. Push to your fork and submit a pull request.
|
||||||
|
|
||||||
My **master** branch is a 100% stable (should be). I only push to it after I am
|
Please use PEP8 as a Python code style. For VIM, just try to style your
|
||||||
certain that things are working out. Many people are using Jedi directly from
|
code similar to the jedi-vim code that is already there.
|
||||||
the github master branch.
|
|
||||||
|
|
||||||
Please use Pep8 to style your code.
|
# Bug reports
|
||||||
|
Please include the output of `:version` and `:JediDebugInfo`.
|
||||||
|
|||||||
183
LICENSE.txt
183
LICENSE.txt
@@ -1,170 +1,21 @@
|
|||||||
Licensed under the GNU LGPL v3 or later.
|
The MIT License (MIT)
|
||||||
Copyright (C) 2012 David Halter <davidhalter88@gmail.com>.
|
|
||||||
|
|
||||||
===============================================================================
|
Copyright (c) <2013> <David Halter and others, see AUTHORS.txt>
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
Version 3, 29 June 2007
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
The above copyright notice and this permission notice shall be included in
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
all copies or substantial portions of the Software.
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
This version of the GNU Lesser General Public License incorporates
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
License, supplemented by the additional permissions listed below.
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
0. Additional Definitions.
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
|
|||||||
35
Makefile
Normal file
35
Makefile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
BUILD_VIRTUAL_ENV:=build/venv
|
||||||
|
|
||||||
|
test:
|
||||||
|
pytest
|
||||||
|
|
||||||
|
test_nvim:
|
||||||
|
VSPEC_VIM=nvim pytest
|
||||||
|
|
||||||
|
test_coverage: export PYTEST_ADDOPTS:=--cov pythonx --cov test --cov-report=term-missing:skip-covered
|
||||||
|
test_coverage: test_nvim
|
||||||
|
|
||||||
|
$(dir $(BUILD_VIRTUAL_ENV)):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(BUILD_VIRTUAL_ENV): | $(dir $(BUILD_VIRTUAL_ENV))
|
||||||
|
python -m venv $@
|
||||||
|
|
||||||
|
$(BUILD_VIRTUAL_ENV)/bin/vint: | $(BUILD_VIRTUAL_ENV)
|
||||||
|
$|/bin/python -m pip install vim-vint==0.3.21
|
||||||
|
|
||||||
|
$(BUILD_VIRTUAL_ENV)/bin/flake8: | $(BUILD_VIRTUAL_ENV)
|
||||||
|
$|/bin/python -m pip install -q flake8==3.7.8
|
||||||
|
|
||||||
|
vint: $(BUILD_VIRTUAL_ENV)/bin/vint
|
||||||
|
$(BUILD_VIRTUAL_ENV)/bin/vint after autoload ftplugin plugin
|
||||||
|
|
||||||
|
flake8: $(BUILD_VIRTUAL_ENV)/bin/flake8
|
||||||
|
$(BUILD_VIRTUAL_ENV)/bin/flake8 pythonx/jedi_*.py
|
||||||
|
|
||||||
|
check: vint flake8
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
|
.PHONY: test check clean vint flake8
|
||||||
259
README.rst
259
README.rst
@@ -1,13 +1,15 @@
|
|||||||
|
.. image:: https://github.com/davidhalter/jedi-vim/blob/master/doc/logotype-a.svg
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
jedi-vim - awesome Python autocompletion with VIM
|
jedi-vim - awesome Python autocompletion with VIM
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
**now in beta testing phase**
|
.. image:: https://travis-ci.org/davidhalter/jedi-vim.svg?branch=master
|
||||||
|
:target: https://travis-ci.org/davidhalter/jedi-vim
|
||||||
|
:alt: Travis-CI build status
|
||||||
|
|
||||||
*If you have any comments or feature requests, please tell me! I really want to
|
jedi-vim is a VIM binding to the autocompletion library
|
||||||
know, what you think about Jedi and jedi-vim.*
|
`Jedi <http://github.com/davidhalter/jedi>`_.
|
||||||
|
|
||||||
jedi-vim is a is a VIM binding to the awesome autocompletion library *Jedi*.
|
|
||||||
|
|
||||||
Here are some pictures:
|
Here are some pictures:
|
||||||
|
|
||||||
@@ -21,41 +23,119 @@ Display of function/class bodies, docstrings.
|
|||||||
|
|
||||||
.. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_pydoc.png
|
.. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_pydoc.png
|
||||||
|
|
||||||
Pydoc support (with highlighting, Shift+k).
|
Documentation (Pydoc) support (with highlighting, Shift+k).
|
||||||
|
|
||||||
There is also support for goto and renaming.
|
There is also support for goto and renaming.
|
||||||
|
|
||||||
|
|
||||||
Get the latest from `github <http://github.com/davidhalter/jedi-vim>`_.
|
Get the latest from `github <http://github.com/davidhalter/jedi-vim>`_.
|
||||||
|
|
||||||
You can get the Jedi library is documented
|
Documentation
|
||||||
`here <http://github.com/davidhalter/jedi>`_.
|
=============
|
||||||
|
|
||||||
|
Documentation is available in your vim: ``:help jedi-vim``. You can also look
|
||||||
|
it up `on github <http://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt>`_.
|
||||||
|
|
||||||
|
You can read the Jedi library documentation `here <http://jedi.readthedocs.io/en/latest/>`_.
|
||||||
|
|
||||||
|
If you want to report issues, just use the github issue tracker. In case of
|
||||||
|
questions about the software, please use `stackoverflow
|
||||||
|
<https://stackoverflow.com/questions/tagged/jedi-vim>`_ and tag your question with ``jedi-vim``.
|
||||||
|
|
||||||
|
|
||||||
Support
|
Contributing
|
||||||
=======
|
============
|
||||||
|
|
||||||
The Jedi library supports most of Python's core features. From decorators to
|
We love Pull Requests! Read the instructions in ``CONTRIBUTING.md``.
|
||||||
|
|
||||||
|
|
||||||
|
Features
|
||||||
|
========
|
||||||
|
|
||||||
|
The Jedi library understands most of Python's core features. From decorators to
|
||||||
generators, there is broad support.
|
generators, there is broad support.
|
||||||
|
|
||||||
|
Apart from that, jedi-vim supports the following commands
|
||||||
|
|
||||||
|
- Completion ``<C-Space>``
|
||||||
|
- Goto assignment ``<leader>g`` (typical goto function)
|
||||||
|
- Goto definition ``<leader>d`` (follow identifier as far as possible,
|
||||||
|
includes imports and statements)
|
||||||
|
- Goto (typing) stub ``<leader>s``
|
||||||
|
- Show Documentation/Pydoc ``K`` (shows a popup with assignments)
|
||||||
|
- Renaming ``<leader>r``
|
||||||
|
- Usages ``<leader>n`` (shows all the usages of a name)
|
||||||
|
- Open module, e.g. ``:Pyimport os`` (opens the ``os`` module)
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
You might want to use `pathogen <https://github.com/tpope/vim-pathogen>`_ to
|
Requirements
|
||||||
install jedi in VIM. Also you need a VIM version that was compiled with
|
------------
|
||||||
``+python``, which is typical for most distributions on Linux.
|
You need a VIM version that was compiled with Python 3 or later
|
||||||
|
(``+python3``). You can check this from within VIM using
|
||||||
|
``:python3 import sys; print(sys.version)``.
|
||||||
|
|
||||||
The first thing you need after that is an up-to-date version of Jedi. You can
|
Manual installation
|
||||||
either get it via ``pip install jedi`` or with ``git submodule update --init``
|
-------------------
|
||||||
in your jedi-vim repository.
|
|
||||||
|
|
||||||
The autocompletion can be used with <ctrl+space>, if you want it to work with
|
You might want to use `pathogen <https://github.com/tpope/vim-pathogen>`_ or
|
||||||
<tab> you can use `supertab <https://github.com/ervandew/supertab>`_.
|
`Vundle <https://github.com/gmarik/vundle>`_ to install jedi-vim.
|
||||||
|
|
||||||
|
The first thing you need after that is an up-to-date version of Jedi. Install
|
||||||
|
``git submodule update --init --recursive`` in your jedi-vim repository.
|
||||||
|
|
||||||
|
Example installation command using Pathogen:
|
||||||
|
|
||||||
|
.. code-block:: sh
|
||||||
|
|
||||||
|
git clone --recursive https://github.com/davidhalter/jedi-vim.git ~/.vim/bundle/jedi-vim
|
||||||
|
|
||||||
|
Example installation using Vundle:
|
||||||
|
|
||||||
|
Add the following line in your `~/.vimrc`
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
Plugin 'davidhalter/jedi-vim'
|
||||||
|
|
||||||
|
For installing Jedi, ``pip install jedi`` will also work, but you might run
|
||||||
|
into issues when working in virtual environments. Please use git submodules.
|
||||||
|
|
||||||
|
|
||||||
Options
|
Installation with your distribution
|
||||||
=======
|
-----------------------------------
|
||||||
|
|
||||||
|
On Arch Linux, you can also install jedi-vim from official repositories as
|
||||||
|
`vim-jedi <https://www.archlinux.org/packages/community/any/vim-jedi/>`__.
|
||||||
|
It is also available on
|
||||||
|
`Debian (≥8) <https://packages.debian.org/vim-python-jedi>`__ and
|
||||||
|
`Ubuntu (≥14.04) <http://packages.ubuntu.com/vim-python-jedi>`__ as
|
||||||
|
vim-python-jedi.
|
||||||
|
On Fedora Linux, it is available as
|
||||||
|
`vim-jedi <https://packages.fedoraproject.org/pkgs/vim-jedi/vim-jedi/>`__.
|
||||||
|
|
||||||
|
Please note that this version might be quite old compared to using jedi-vim
|
||||||
|
from Git.
|
||||||
|
|
||||||
|
Caveats
|
||||||
|
-------
|
||||||
|
|
||||||
|
Note that the `python-mode <https://github.com/klen/python-mode>`_ VIM plugin seems
|
||||||
|
to conflict with jedi-vim, therefore you should disable it before enabling
|
||||||
|
jedi-vim.
|
||||||
|
|
||||||
|
To enjoy the full features of jedi-vim, you should have VIM >= 7.3, compiled with
|
||||||
|
``+conceal`` (which is not the case on some platforms, including OS X). If your VIM
|
||||||
|
does not meet these requirements, the parameter recommendation list may not appear
|
||||||
|
when you type an open bracket after a function name. Please read
|
||||||
|
`the documentation <http://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt>`_
|
||||||
|
for details.
|
||||||
|
|
||||||
|
|
||||||
|
Settings
|
||||||
|
========
|
||||||
|
|
||||||
Jedi is by default automatically initialized. If you don't want that I suggest
|
Jedi is by default automatically initialized. If you don't want that I suggest
|
||||||
you disable the auto-initialization in your ``.vimrc``:
|
you disable the auto-initialization in your ``.vimrc``:
|
||||||
@@ -64,37 +144,27 @@ you disable the auto-initialization in your ``.vimrc``:
|
|||||||
|
|
||||||
let g:jedi#auto_initialization = 0
|
let g:jedi#auto_initialization = 0
|
||||||
|
|
||||||
There are also some VIM options (like ``completeopt``) which are automatically
|
There are also some VIM options (like ``completeopt`` and key defaults) which
|
||||||
initialized, if you don't want that:
|
are automatically initialized, but you can skip this:
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#auto_vim_configuration = 0
|
let g:jedi#auto_vim_configuration = 0
|
||||||
|
|
||||||
The goto is by default on <leader g>. If you want to change that:
|
|
||||||
|
You can make jedi-vim use tabs when going to a definition etc:
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#goto_command = "<leader>g"
|
let g:jedi#use_tabs_not_buffers = 1
|
||||||
|
|
||||||
``get_definition`` is by default on <leader d>. If you want to change that:
|
If you are a person who likes to use VIM-splits, you might want to put this in your ``.vimrc``:
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#get_definition_command = "<leader>d"
|
let g:jedi#use_splits_not_buffers = "left"
|
||||||
|
|
||||||
Showing the pydoc is by default on ``K`` If you want to change that:
|
This options could be "left", "right", "top", "bottom" or "winwidth". It will decide the direction where the split open.
|
||||||
|
|
||||||
.. code-block:: vim
|
|
||||||
|
|
||||||
let g:jedi#pydoc = "K"
|
|
||||||
|
|
||||||
If you are a person who likes to use VIM-buffers not tabs, you might want to
|
|
||||||
put that in your ``.vimrc``:
|
|
||||||
|
|
||||||
.. code-block:: vim
|
|
||||||
|
|
||||||
let g:jedi#use_tabs_not_buffers = 0
|
|
||||||
|
|
||||||
Jedi automatically starts the completion, if you type a dot, e.g. ``str.``, if
|
Jedi automatically starts the completion, if you type a dot, e.g. ``str.``, if
|
||||||
you don't want this:
|
you don't want this:
|
||||||
@@ -103,27 +173,122 @@ you don't want this:
|
|||||||
|
|
||||||
let g:jedi#popup_on_dot = 0
|
let g:jedi#popup_on_dot = 0
|
||||||
|
|
||||||
There's some support for refactoring:
|
Jedi selects the first line of the completion menu: for a better typing-flow
|
||||||
|
and usually saves one keypress.
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
|
let g:jedi#popup_select_first = 0
|
||||||
|
|
||||||
|
Jedi displays function call signatures in insert mode in real-time, highlighting
|
||||||
|
the current argument. The call signatures can be displayed as a pop-up in the
|
||||||
|
buffer (set to 1 by default (with the conceal feature), 2 otherwise),
|
||||||
|
which has the advantage of being easier to refer to (but is a hack with
|
||||||
|
many drawbacks since it changes the buffer's contents),
|
||||||
|
or in Vim's command line aligned with the function call (set to 2), which
|
||||||
|
can improve the integrity of Vim's undo history.
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
let g:jedi#show_call_signatures = "1"
|
||||||
|
|
||||||
|
Here are a few more defaults for actions, read the docs (``:help jedi-vim``) to
|
||||||
|
get more information. If you set them to ``""``, they are not assigned.
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
NOTE: subject to change!
|
||||||
|
|
||||||
|
let g:jedi#goto_command = "<leader>d"
|
||||||
|
let g:jedi#goto_assignments_command = "<leader>g"
|
||||||
|
let g:jedi#goto_stubs_command = "<leader>s"
|
||||||
|
let g:jedi#goto_definitions_command = ""
|
||||||
|
let g:jedi#documentation_command = "K"
|
||||||
|
let g:jedi#usages_command = "<leader>n"
|
||||||
|
let g:jedi#completions_command = "<C-Space>"
|
||||||
let g:jedi#rename_command = "<leader>r"
|
let g:jedi#rename_command = "<leader>r"
|
||||||
|
let g:jedi#rename_command_keep_name = "<leader>R"
|
||||||
|
|
||||||
And you can list all names that are related (have the same origin):
|
An example for setting up your project:
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#related_names_command = "<leader>n"
|
let g:jedi#environment_path = "/usr/bin/python3.9"
|
||||||
|
|
||||||
If you want to change the default autocompletion command:
|
jedi-vim tries its best to guess your virtual env. If you want to work with a
|
||||||
|
specific virtual environment however, you can point jedi-vim towards it:
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#autocompletion_command = "<C-Space>"
|
let g:jedi#environment_path = "venv"
|
||||||
|
|
||||||
By default you get a window that displays the function definition you're
|
Finally, if you don't want completion, but all the other features, use:
|
||||||
currently in. If you don't want that:
|
|
||||||
|
|
||||||
.. code-block:: vim
|
.. code-block:: vim
|
||||||
|
|
||||||
let g:jedi#show_function_definition = "0"
|
let g:jedi#completions_enabled = 0
|
||||||
|
|
||||||
|
FAQ
|
||||||
|
===
|
||||||
|
|
||||||
|
I want to use Jedi with a Python 2 Environment, but it's not listed under "Known environments"
|
||||||
|
----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Starting with version 0.18.0 Jedi dropped support for Python 2.
|
||||||
|
|
||||||
|
|
||||||
|
I don't want the docstring window to popup during completion
|
||||||
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
This depends on the ``completeopt`` option. Jedi initializes it in its
|
||||||
|
``ftplugin``. Add the following line to your ``.vimrc`` to disable it:
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
autocmd FileType python setlocal completeopt-=preview
|
||||||
|
|
||||||
|
|
||||||
|
I want <Tab> to do autocompletion
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
Don't even think about changing the Jedi command to ``<Tab>``,
|
||||||
|
use `supertab <https://github.com/ervandew/supertab>`_!
|
||||||
|
|
||||||
|
|
||||||
|
The completion is too slow!
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
1. Completion of complex libraries (like Numpy) should only be slow the first
|
||||||
|
time you complete them. After that the results should be cached and very fast.
|
||||||
|
|
||||||
|
2. If it is still slow after the initial completion and you have installed the
|
||||||
|
python-mode Vim plugin, try disabling its rope mode:
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
let g:pymode_rope = 0
|
||||||
|
|
||||||
|
See issue `#163 <https://github.com/davidhalter/jedi-vim/issues/163>`__.
|
||||||
|
|
||||||
|
3. You can also use `deoplete-jedi <https://github.com/zchee/deoplete-jedi>`__
|
||||||
|
for completions, which uses Jedi, but does completions asynchronously
|
||||||
|
(requires Neovim).
|
||||||
|
It makes sense to use both jedi-vim and deoplete-jedi, but you should disable
|
||||||
|
jedi-vim's completions then:
|
||||||
|
|
||||||
|
.. code-block:: vim
|
||||||
|
|
||||||
|
let g:jedi#completions_enabled = 0
|
||||||
|
|
||||||
|
Testing
|
||||||
|
=======
|
||||||
|
|
||||||
|
jedi-vim is being tested with a combination of `vspec
|
||||||
|
<https://github.com/kana/vim-vspec>`_ and `py.test <http://pytest.org/>`_.
|
||||||
|
|
||||||
|
The tests are in the ``test`` subdirectory, you can run them calling::
|
||||||
|
|
||||||
|
py.test
|
||||||
|
|
||||||
|
The tests are automatically run with `travis
|
||||||
|
<https://travis-ci.org/davidhalter/jedi-vim>`_.
|
||||||
|
|||||||
3
after/ftplugin/python/jedi.vim
Normal file
3
after/ftplugin/python/jedi.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
if jedi#init_python() && g:jedi#auto_initialization && g:jedi#completions_enabled
|
||||||
|
call jedi#setup_completion()
|
||||||
|
endif
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
if g:jedi#show_function_definition == 1 && has('conceal')
|
if !jedi#init_python()
|
||||||
" conceal is normal for vim >= 7.3
|
finish
|
||||||
|
|
||||||
let e = g:jedi#function_definition_escape
|
|
||||||
let l1 = e.'jedi=[^'.e.']*'.e.'[^'.e.']*'.e.'jedi'.e
|
|
||||||
let l2 = e.'jedi=\?[^'.e.']*'.e
|
|
||||||
exe 'syn match jediIgnore "'.l2.'" contained conceal'
|
|
||||||
setlocal conceallevel=2
|
|
||||||
syn match jediFatSymbol "*" contained conceal
|
|
||||||
syn match jediFat "\*[^*]\+\*" contained contains=jediFatSymbol
|
|
||||||
syn match jediSpace "\v[ ]+( )@=" contained
|
|
||||||
exe 'syn match jediFunction "'.l1.'" keepend extend contains=jediIgnore,jediFat,jediSpace'
|
|
||||||
|
|
||||||
hi def link jediIgnore Ignore
|
|
||||||
hi def link jediFatSymbol Ignore
|
|
||||||
hi def link jediSpace Normal
|
|
||||||
hi jediFat term=bold,underline cterm=bold,underline gui=bold,underline ctermbg=0 guibg=#555555
|
|
||||||
hi jediFunction term=NONE cterm=NONE ctermfg=6 guifg=Black gui=NONE ctermbg=0 guibg=Grey
|
|
||||||
|
|
||||||
" override defaults (add jediFunction to contains)
|
|
||||||
syn match pythonComment "#.*$" contains=pythonTodo,@Spell,jediFunction
|
|
||||||
syn region pythonString
|
|
||||||
\ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
|
|
||||||
\ contains=pythonEscape,@Spell,jediFunction
|
|
||||||
syn region pythonString
|
|
||||||
\ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
|
|
||||||
\ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell,jediFunction
|
|
||||||
syn region pythonRawString
|
|
||||||
\ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
|
|
||||||
\ contains=@Spell,jediFunction
|
|
||||||
syn region pythonRawString
|
|
||||||
\ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
|
|
||||||
\ contains=pythonSpaceError,pythonDoctest,@Spell,jediFunction
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:jedi#show_call_signatures > 0 && has('conceal')
|
||||||
|
" +conceal is the default for vim >= 7.3
|
||||||
|
|
||||||
|
let s:e = g:jedi#call_signature_escape
|
||||||
|
let s:full = s:e.'jedi=.\{-}'.s:e.'.\{-}'.s:e.'jedi'.s:e
|
||||||
|
let s:ignore = s:e.'jedi.\{-}'.s:e
|
||||||
|
exe 'syn match jediIgnore "'.s:ignore.'" contained conceal'
|
||||||
|
setlocal conceallevel=2
|
||||||
|
syn match jediFatSymbol "\*_\*" contained conceal
|
||||||
|
syn match jediFat "\*_\*.\{-}\*_\*" contained contains=jediFatSymbol
|
||||||
|
syn match jediSpace "\v[ ]+( )@=" contained
|
||||||
|
exe 'syn match jediFunction "'.s:full.'" keepend extend '
|
||||||
|
\ .' contains=jediIgnore,jediFat,jediSpace'
|
||||||
|
\ .' containedin=pythonComment,pythonString,pythonRawString'
|
||||||
|
unlet! s:e s:full s:ignore
|
||||||
|
|
||||||
|
hi def link jediIgnore Ignore
|
||||||
|
hi def link jediFatSymbol Ignore
|
||||||
|
hi def link jediSpace Normal
|
||||||
|
|
||||||
|
if exists('g:colors_name')
|
||||||
|
hi def link jediFunction CursorLine
|
||||||
|
hi def link jediFat TabLine
|
||||||
|
else
|
||||||
|
hi def jediFunction term=NONE cterm=NONE ctermfg=6 guifg=Black gui=NONE ctermbg=0 guibg=Grey
|
||||||
|
hi def jediFat term=bold,underline cterm=bold,underline gui=bold,underline ctermbg=0 guibg=#555555
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi def jediUsage cterm=reverse gui=standout
|
||||||
|
|||||||
4
autoload/health/jedi.vim
Normal file
4
autoload/health/jedi.vim
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
function! health#jedi#check() abort
|
||||||
|
call health#report_start('jedi')
|
||||||
|
silent call jedi#debug_info()
|
||||||
|
endfunction
|
||||||
@@ -1,57 +1,442 @@
|
|||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
" Settings initialization
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
let s:deprecations = {
|
||||||
|
\ 'get_definition_command': 'goto_definitions_command',
|
||||||
|
\ 'pydoc': 'documentation_command',
|
||||||
|
\ 'related_names_command': 'usages_command',
|
||||||
|
\ 'autocompletion_command': 'completions_command',
|
||||||
|
\ 'show_function_definition': 'show_call_signatures',
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let s:default_settings = {
|
||||||
|
\ 'use_tabs_not_buffers': 0,
|
||||||
|
\ 'use_splits_not_buffers': 1,
|
||||||
|
\ 'auto_initialization': 1,
|
||||||
|
\ 'auto_vim_configuration': 1,
|
||||||
|
\ 'goto_command': "'<leader>d'",
|
||||||
|
\ 'goto_assignments_command': "'<leader>g'",
|
||||||
|
\ 'goto_definitions_command': "''",
|
||||||
|
\ 'goto_stubs_command': "'<leader>s'",
|
||||||
|
\ 'completions_command': "'<C-Space>'",
|
||||||
|
\ 'call_signatures_command': "'<leader>n'",
|
||||||
|
\ 'usages_command': "'<leader>n'",
|
||||||
|
\ 'rename_command': "'<leader>r'",
|
||||||
|
\ 'rename_command_keep_name': "'<leader>R'",
|
||||||
|
\ 'completions_enabled': 1,
|
||||||
|
\ 'popup_on_dot': 'g:jedi#completions_enabled',
|
||||||
|
\ 'documentation_command': "'K'",
|
||||||
|
\ 'show_call_signatures': has('conceal') ? 1 : 2,
|
||||||
|
\ 'show_call_signatures_delay': 500,
|
||||||
|
\ 'call_signature_escape': "'?!?'",
|
||||||
|
\ 'auto_close_doc': 1,
|
||||||
|
\ 'max_doc_height': 30,
|
||||||
|
\ 'popup_select_first': 1,
|
||||||
|
\ 'quickfix_window_height': 10,
|
||||||
|
\ 'force_py_version': "'auto'",
|
||||||
|
\ 'environment_path': "'auto'",
|
||||||
|
\ 'added_sys_path': '[]',
|
||||||
|
\ 'project_path': "'auto'",
|
||||||
|
\ 'smart_auto_mappings': 0,
|
||||||
|
\ 'case_insensitive_completion': 1,
|
||||||
|
\ 'use_tag_stack': 1
|
||||||
|
\ }
|
||||||
|
|
||||||
|
for [s:key, s:val] in items(s:deprecations)
|
||||||
|
if exists('g:jedi#'.s:key)
|
||||||
|
echom "'g:jedi#".s:key."' is deprecated. Please use 'g:jedi#".s:val."' instead. Sorry for the inconvenience."
|
||||||
|
exe 'let g:jedi#'.s:val.' = g:jedi#'.s:key
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
for [s:key, s:val] in items(s:default_settings)
|
||||||
|
if !exists('g:jedi#'.s:key)
|
||||||
|
exe 'let g:jedi#'.s:key.' = '.s:val
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let s:supports_buffer_usages = has('nvim') || exists('*prop_add')
|
||||||
|
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
" Python initialization
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
let s:script_path = expand('<sfile>:p:h:h')
|
||||||
|
|
||||||
|
function! s:init_python() abort
|
||||||
|
" Use g:jedi#force_py_version for loading Jedi, or fall back to using
|
||||||
|
" `has()` - preferring Python 3.
|
||||||
|
if !has('python3')
|
||||||
|
throw 'jedi-vim requires Vim with support for Python 3.'
|
||||||
|
endif
|
||||||
|
call jedi#setup_python_imports()
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#reinit_python() abort
|
||||||
|
let s:_init_python = -1
|
||||||
|
call jedi#init_python()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" This is meant to be called with `:unsilent` (for &shortmess+=F).
|
||||||
|
function! s:display_exception() abort
|
||||||
|
let error_lines = split(v:exception, '\n')
|
||||||
|
let msg = 'Error: jedi-vim failed to initialize Python: '
|
||||||
|
\ .error_lines[0].' (in '.v:throwpoint.')'
|
||||||
|
if len(error_lines) > 1
|
||||||
|
echohl ErrorMsg
|
||||||
|
echom 'jedi-vim error: '.error_lines[0]
|
||||||
|
for line in error_lines[1:]
|
||||||
|
echom line
|
||||||
|
endfor
|
||||||
|
echohl None
|
||||||
|
let help_cmd = ':JediDebugInfo'
|
||||||
|
if exists(':checkhealth') == 2
|
||||||
|
let help_cmd .= ' / :checkhealth'
|
||||||
|
endif
|
||||||
|
let msg .= printf('. See :messages and/or %s for more information.',
|
||||||
|
\ help_cmd)
|
||||||
|
endif
|
||||||
|
redraw " Redraw to only have the main message by default.
|
||||||
|
echoerr msg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
let s:_init_python = -1
|
||||||
|
function! jedi#init_python() abort
|
||||||
|
if s:_init_python == -1
|
||||||
|
let s:_init_python = 0
|
||||||
|
try
|
||||||
|
let s:_init_python = s:init_python()
|
||||||
|
let s:_init_python = 1
|
||||||
|
catch /^jedi/
|
||||||
|
" Only catch errors from jedi-vim itself here, so that for
|
||||||
|
" unexpected Python exceptions the traceback will be shown
|
||||||
|
" (e.g. with NameError in jedi#setup_python_imports's code).
|
||||||
|
if !exists('g:jedi#squelch_py_warning')
|
||||||
|
unsilent call s:display_exception()
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
return s:_init_python
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#setup_python_imports() abort
|
||||||
|
let g:_jedi_init_error = 0
|
||||||
|
let init_lines = [
|
||||||
|
\ 'import vim',
|
||||||
|
\ 'def _jedi_handle_exc(exc_info):',
|
||||||
|
\ ' try:',
|
||||||
|
\ ' from jedi_vim_debug import format_exc_info',
|
||||||
|
\ ' vim.vars["_jedi_init_error"] = format_exc_info(exc_info)',
|
||||||
|
\ ' except Exception:',
|
||||||
|
\ ' import traceback',
|
||||||
|
\ ' vim.vars["_jedi_init_error"] = "\\n".join(traceback.format_exception(*exc_info))',
|
||||||
|
\ 'try:',
|
||||||
|
\ ' import jedi_vim',
|
||||||
|
\ ' if hasattr(jedi_vim, "jedi_import_error"):',
|
||||||
|
\ ' _jedi_handle_exc(jedi_vim.jedi_import_error)',
|
||||||
|
\ 'except Exception as exc:',
|
||||||
|
\ ' _jedi_handle_exc(sys.exc_info())',
|
||||||
|
\ ]
|
||||||
|
exe 'python3 exec('''.escape(join(init_lines, '\n'), "'").''')'
|
||||||
|
if g:_jedi_init_error isnot 0
|
||||||
|
throw printf('jedi#setup_python_imports: %s', g:_jedi_init_error)
|
||||||
|
endif
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#debug_info() abort
|
||||||
|
if &verbose
|
||||||
|
if &filetype !=# 'python'
|
||||||
|
echohl WarningMsg | echo 'You should run this in a buffer with filetype "python".' | echohl None
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let spath = shellescape(s:script_path)
|
||||||
|
echo '#### Jedi-vim debug information'
|
||||||
|
echo "\n"
|
||||||
|
echo '##### jedi-vim version'
|
||||||
|
echo "\n"
|
||||||
|
echo ' - jedi-vim git version: '
|
||||||
|
echon substitute(system('git -C '.spath.' describe --tags --always --dirty'), '\v\n$', '', '')
|
||||||
|
echo ' - jedi git submodule status: '
|
||||||
|
echon substitute(system('git -C '.spath.' submodule status pythonx/jedi'), '\v\n$', '', '')
|
||||||
|
echo ' - parso git submodule status: '
|
||||||
|
echon substitute(system('git -C '.spath.' submodule status pythonx/parso'), '\v\n$', '', '')
|
||||||
|
echo "\n"
|
||||||
|
echo '##### Global Python'
|
||||||
|
echo "\n"
|
||||||
|
echo 'Using Python version 3 to access Jedi.'
|
||||||
|
let s:pythonjedi_called = 0
|
||||||
|
try
|
||||||
|
python3 import vim; vim.command('let s:pythonjedi_called = 1')
|
||||||
|
catch
|
||||||
|
echo 'Error when trying to import vim: '.v:exception
|
||||||
|
endtry
|
||||||
|
if !s:pythonjedi_called
|
||||||
|
echohl WarningMsg
|
||||||
|
echom 'python3 failed to run, likely a Python config issue.'
|
||||||
|
if exists(':checkhealth') == 2
|
||||||
|
echom 'Try :checkhealth for more information.'
|
||||||
|
endif
|
||||||
|
echohl None
|
||||||
|
else
|
||||||
|
try
|
||||||
|
python3 from jedi_vim_debug import display_debug_info
|
||||||
|
python3 display_debug_info()
|
||||||
|
catch
|
||||||
|
echohl WarningMsg
|
||||||
|
echo 'Error when running display_debug_info: '.v:exception
|
||||||
|
echohl None
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
echo "\n"
|
||||||
|
echo '##### Settings'
|
||||||
|
echo "\n"
|
||||||
|
echo '```'
|
||||||
|
let jedi_settings = items(filter(copy(g:), "v:key =~# '\\v^jedi#'"))
|
||||||
|
let has_nondefault_settings = 0
|
||||||
|
for [k, V] in jedi_settings
|
||||||
|
exe 'let default = '.get(s:default_settings,
|
||||||
|
\ substitute(k, '\v^jedi#', '', ''), "'-'")
|
||||||
|
" vint: -ProhibitUsingUndeclaredVariable
|
||||||
|
if default !=# V
|
||||||
|
echo printf('g:%s = %s (default: %s)', k, string(V), string(default))
|
||||||
|
unlet! V " Fix variable type mismatch with Vim 7.3.
|
||||||
|
let has_nondefault_settings = 1
|
||||||
|
endif
|
||||||
|
" vint: +ProhibitUsingUndeclaredVariable
|
||||||
|
endfor
|
||||||
|
if has_nondefault_settings
|
||||||
|
echo "\n"
|
||||||
|
endif
|
||||||
|
verb set omnifunc? completeopt?
|
||||||
|
echo '```'
|
||||||
|
|
||||||
|
if &verbose
|
||||||
|
echo "\n"
|
||||||
|
echo '#### :version'
|
||||||
|
echo '```'
|
||||||
|
version
|
||||||
|
echo '```'
|
||||||
|
echo "\n"
|
||||||
|
echo '#### :messages'
|
||||||
|
echo '```'
|
||||||
|
messages
|
||||||
|
echo '```'
|
||||||
|
echo "\n"
|
||||||
|
echo '<details><summary>:scriptnames</summary>'
|
||||||
|
echo "\n"
|
||||||
|
echo '```'
|
||||||
|
scriptnames
|
||||||
|
echo '```'
|
||||||
|
echo '</details>'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Helper function instead of `python vim.eval()`, and `.command()` because
|
||||||
|
" these also return error definitions.
|
||||||
|
function! jedi#_vim_exceptions(str, is_eval) abort
|
||||||
|
let l:result = {}
|
||||||
|
try
|
||||||
|
if a:is_eval
|
||||||
|
let l:result.result = eval(a:str)
|
||||||
|
else
|
||||||
|
execute a:str
|
||||||
|
let l:result.result = ''
|
||||||
|
endif
|
||||||
|
catch
|
||||||
|
let l:result.exception = v:exception
|
||||||
|
let l:result.throwpoint = v:throwpoint
|
||||||
|
endtry
|
||||||
|
return l:result
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call jedi#init_python() " Might throw an error.
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" functions that call python code
|
" functions that call python code
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
function! jedi#goto()
|
function! jedi#goto() abort
|
||||||
Python jedi_vim.goto()
|
python3 jedi_vim.goto(mode="goto")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#goto_assignments() abort
|
||||||
function! jedi#get_definition()
|
python3 jedi_vim.goto(mode="assignment")
|
||||||
Python jedi_vim.goto(is_definition=True)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#goto_definitions() abort
|
||||||
function! jedi#related_names()
|
python3 jedi_vim.goto(mode="definition")
|
||||||
Python jedi_vim.goto(is_related_name=True)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#goto_stubs() abort
|
||||||
function! jedi#rename(...)
|
python3 jedi_vim.goto(mode="stubs")
|
||||||
Python jedi_vim.rename()
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#usages() abort
|
||||||
function! jedi#complete(findstart, base)
|
if exists('#jedi_usages#BufWinEnter')
|
||||||
Python jedi_vim.complete()
|
call jedi#clear_usages()
|
||||||
|
endif
|
||||||
|
python3 jedi_vim.usages()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if !s:supports_buffer_usages
|
||||||
|
" Hide usages in the current window.
|
||||||
|
" Only handles the current window due to matchdelete() restrictions.
|
||||||
|
function! jedi#_hide_usages_in_win() abort
|
||||||
|
let winnr = winnr()
|
||||||
|
let matchids = getwinvar(winnr, '_jedi_usages_vim_matchids', [])
|
||||||
|
|
||||||
function! jedi#show_func_def()
|
for matchid in matchids[1:]
|
||||||
Python jedi_vim.show_func_def()
|
call matchdelete(matchid)
|
||||||
|
endfor
|
||||||
|
call setwinvar(winnr, '_jedi_usages_vim_matchids', [])
|
||||||
|
|
||||||
|
" Remove the autocommands that might have triggered this function.
|
||||||
|
augroup jedi_usages
|
||||||
|
exe 'autocmd! * <buffer='.winbufnr(winnr).'>'
|
||||||
|
augroup END
|
||||||
|
unlet! b:_jedi_usages_needs_clear
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! jedi#enable_speed_debugging()
|
" Show usages for current window (Vim without textprops only).
|
||||||
Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
function! jedi#_show_usages_in_win() abort
|
||||||
|
python3 jedi_vim.highlight_usages_for_vim_win()
|
||||||
|
|
||||||
|
if !exists('#jedi_usages#TextChanged#<buffer>')
|
||||||
|
augroup jedi_usages
|
||||||
|
" Unset highlights on any changes to this buffer.
|
||||||
|
" NOTE: Neovim's API handles movement of highlights, but would only
|
||||||
|
" need to clear highlights that are changed inline.
|
||||||
|
autocmd TextChanged <buffer> call jedi#_clear_buffer_usages()
|
||||||
|
|
||||||
|
" Hide usages when the buffer is removed from the window, or when
|
||||||
|
" entering insert mode (but keep them for later).
|
||||||
|
autocmd BufWinLeave,InsertEnter <buffer> call jedi#_hide_usages_in_win()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! jedi#enable_debugging()
|
" Remove usages for the current buffer (and all its windows).
|
||||||
Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
|
function! jedi#_clear_buffer_usages() abort
|
||||||
endfunction
|
let bufnr = bufnr('%')
|
||||||
|
let nvim_src_ids = getbufvar(bufnr, '_jedi_usages_src_ids', [])
|
||||||
function! jedi#disable_debugging()
|
if !empty(nvim_src_ids)
|
||||||
Python jedi_vim.jedi.set_debug_function(None)
|
for src_id in nvim_src_ids
|
||||||
endfunction
|
" TODO: could only clear highlights below/after changed line?!
|
||||||
|
call nvim_buf_clear_highlight(bufnr, src_id, 0, -1)
|
||||||
" ------------------------------------------------------------------------
|
endfor
|
||||||
" show_pydoc
|
|
||||||
" ------------------------------------------------------------------------
|
|
||||||
function! jedi#show_pydoc()
|
|
||||||
Python jedi_vim.show_pydoc()
|
|
||||||
if bufnr("__doc__") > 0
|
|
||||||
" If the __doc__ buffer is open in the current window, jump to it
|
|
||||||
silent execute "sbuffer ".bufnr("__doc__")
|
|
||||||
else
|
else
|
||||||
split '__doc__'
|
call jedi#_hide_usages_in_win()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Remove/unset global usages.
|
||||||
|
function! jedi#clear_usages() abort
|
||||||
|
augroup jedi_usages
|
||||||
|
autocmd! BufWinEnter
|
||||||
|
autocmd! WinEnter
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
if !s:supports_buffer_usages
|
||||||
|
" Vim without textprops: clear current window,
|
||||||
|
" autocommands will clean others on demand.
|
||||||
|
call jedi#_hide_usages_in_win()
|
||||||
|
|
||||||
|
" Setup autocommands to clear remaining highlights on WinEnter.
|
||||||
|
augroup jedi_usages
|
||||||
|
for b in range(1, bufnr('$'))
|
||||||
|
if getbufvar(b, '_jedi_usages_needs_clear')
|
||||||
|
exe 'autocmd WinEnter <buffer='.b.'> call jedi#_hide_usages_in_win()'
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
python3 jedi_vim.clear_usages()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#rename(...) abort
|
||||||
|
python3 jedi_vim.rename()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#rename_visual(...) abort
|
||||||
|
python3 jedi_vim.rename_visual()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#rename_keep_name(...) abort
|
||||||
|
python3 jedi_vim.rename(delete_word=False)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#rename_visual_keep_name(...) abort
|
||||||
|
python3 jedi_vim.rename_visual(use_selected_text_as_prompt_answer=True)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#completions(findstart, base) abort
|
||||||
|
python3 jedi_vim.completions()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#enable_speed_debugging() abort
|
||||||
|
python3 jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#enable_debugging() abort
|
||||||
|
python3 jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#disable_debugging() abort
|
||||||
|
python3 jedi_vim.jedi.set_debug_function(None)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! jedi#py_import(args) abort
|
||||||
|
python3 jedi_vim.py_import()
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! jedi#choose_environment(args) abort
|
||||||
|
python3 jedi_vim.choose_environment()
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! jedi#load_project(args) abort
|
||||||
|
python3 jedi_vim.load_project()
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! jedi#py_import_completions(argl, cmdl, pos) abort
|
||||||
|
python3 jedi_vim.py_import_completions()
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! jedi#clear_cache(bang) abort
|
||||||
|
if a:bang
|
||||||
|
python3 jedi_vim.jedi.cache.clear_time_caches(True)
|
||||||
|
else
|
||||||
|
python3 jedi_vim.jedi.cache.clear_time_caches(False)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
" show_documentation
|
||||||
|
" ------------------------------------------------------------------------
|
||||||
|
function! jedi#show_documentation() abort
|
||||||
|
python3 if jedi_vim.show_documentation() is None: vim.command('return')
|
||||||
|
|
||||||
|
let bn = bufnr('__doc__')
|
||||||
|
if bn > 0
|
||||||
|
let wi=index(tabpagebuflist(tabpagenr()), bn)
|
||||||
|
if wi >= 0
|
||||||
|
" If the __doc__ buffer is open in the current tab, jump to it
|
||||||
|
silent execute (wi+1).'wincmd w'
|
||||||
|
else
|
||||||
|
silent execute 'sbuffer '.bn
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
split __doc__
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
@@ -63,80 +448,95 @@ function! jedi#show_pydoc()
|
|||||||
setlocal nomodifiable
|
setlocal nomodifiable
|
||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
setlocal filetype=rst
|
setlocal filetype=rst
|
||||||
|
setlocal foldlevel=200 " do not fold in __doc__
|
||||||
|
|
||||||
if l:doc_lines > 30 " max lines for plugin
|
if l:doc_lines > g:jedi#max_doc_height " max lines for plugin
|
||||||
let l:doc_lines = 30
|
let l:doc_lines = g:jedi#max_doc_height
|
||||||
endif
|
endif
|
||||||
execute "resize ".l:doc_lines
|
execute 'resize '.l:doc_lines
|
||||||
|
|
||||||
" quit comands
|
" quit comands
|
||||||
nnoremap <buffer> q ZQ
|
nnoremap <buffer> q ZQ
|
||||||
nnoremap <buffer> K ZQ
|
if len(g:jedi#documentation_command)
|
||||||
|
execute 'nnoremap <buffer> '.g:jedi#documentation_command.' ZQ'
|
||||||
" highlight python code within rst
|
endif
|
||||||
unlet! b:current_syntax
|
|
||||||
syn include @rstPythonScript syntax/python.vim
|
|
||||||
" 4 spaces
|
|
||||||
syn region rstPythonRegion start=/^\v {4}/ end=/\v^( {4}|\n)@!/ contains=@rstPythonScript
|
|
||||||
" >>> python code -> (doctests)
|
|
||||||
syn region rstPythonRegion matchgroup=pythonDoctest start=/^>>>\s*/ end=/\n/ contains=@rstPythonScript
|
|
||||||
let b:current_syntax = "rst"
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" helper functions
|
" helper functions
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
function! jedi#new_buffer(path)
|
|
||||||
if g:jedi#use_tabs_not_buffers
|
|
||||||
Python jedi_vim.tabnew(jedi_vim.escape_file_path(vim.eval('a:path')))
|
|
||||||
else
|
|
||||||
if !&hidden && &modified
|
|
||||||
w
|
|
||||||
endif
|
|
||||||
Python vim.command('edit ' + jedi_vim.escape_file_path(vim.eval('a:path')))
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:add_goto_window()
|
function! jedi#add_goto_window(for_usages, len) abort
|
||||||
set lazyredraw
|
let height = min([a:len, g:jedi#quickfix_window_height])
|
||||||
cclose
|
|
||||||
execute 'belowright copen 3'
|
" Use :copen to go to the window always - the user should select an entry.
|
||||||
set nolazyredraw
|
execute 'belowright copen '.height
|
||||||
|
|
||||||
|
if &filetype !=# 'qf'
|
||||||
|
echoerr printf('jedi-vim: unexpected ft with current window (%s), please report!', &filetype)
|
||||||
|
endif
|
||||||
if g:jedi#use_tabs_not_buffers == 1
|
if g:jedi#use_tabs_not_buffers == 1
|
||||||
map <buffer> <CR> :call jedi#goto_window_on_enter()<CR>
|
noremap <buffer> <CR> :call jedi#goto_window_on_enter()<CR>
|
||||||
endif
|
endif
|
||||||
au WinLeave <buffer> q " automatically leave, if an option is chosen
|
|
||||||
redraw!
|
augroup jedi_goto_window
|
||||||
|
if a:for_usages
|
||||||
|
autocmd BufWinLeave <buffer> call jedi#clear_usages()
|
||||||
|
else
|
||||||
|
autocmd WinLeave <buffer> q " automatically leave, if an option is chosen
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
if a:for_usages && !has('nvim')
|
||||||
|
if s:supports_buffer_usages
|
||||||
|
" Setup autocommand for pending highlights with Vim's textprops.
|
||||||
|
" (cannot be added to unlisted buffers)
|
||||||
|
augroup jedi_usages
|
||||||
|
autocmd! BufWinEnter * call s:usages_for_pending_buffers()
|
||||||
|
augroup END
|
||||||
|
else
|
||||||
|
" Setup global autocommand to display any usages for a window.
|
||||||
|
" Gets removed when closing the quickfix window that displays them, or
|
||||||
|
" when clearing them (e.g. on TextChanged).
|
||||||
|
augroup jedi_usages
|
||||||
|
autocmd! BufWinEnter,WinEnter * call jedi#_show_usages_in_win()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Highlight usages for a buffer if not done so yet (Neovim only).
|
||||||
|
function! s:usages_for_pending_buffers() abort
|
||||||
|
python3 jedi_vim._handle_pending_usages_for_buf()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! jedi#goto_window_on_enter()
|
function! jedi#goto_window_on_enter() abort
|
||||||
let l:list = getqflist()
|
let l:list = getqflist()
|
||||||
let l:data = l:list[line('.') - 1]
|
let l:data = l:list[line('.') - 1]
|
||||||
if l:data.bufnr
|
if l:data.bufnr
|
||||||
" close goto_window buffer
|
" close goto_window buffer
|
||||||
normal ZQ
|
normal! ZQ
|
||||||
jedi#new_buffer(bufname(l:data.bufnr))
|
python3 jedi_vim.set_buffer(vim.eval('bufname(l:data.bufnr)'))
|
||||||
call cursor(l:data.lnum, l:data.col)
|
call cursor(l:data.lnum, l:data.col)
|
||||||
else
|
else
|
||||||
echohl WarningMsg | echo "Builtin module cannot be opened." | echohl None
|
echohl WarningMsg | echo 'Builtin module cannot be opened.' | echohl None
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! jedi#syn_stack()
|
function! s:syn_stack() abort
|
||||||
if !exists("*synstack")
|
if !exists('*synstack')
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
return map(synstack(line('.'), col('.') - 1), 'synIDattr(v:val, "name")')
|
return map(synstack(line('.'), col('.') - 1), "synIDattr(v:val, 'name')")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
function! jedi#do_popup_on_dot()
|
function! jedi#do_popup_on_dot_in_highlight() abort
|
||||||
let highlight_groups = jedi#syn_stack()
|
let highlight_groups = s:syn_stack()
|
||||||
for a in highlight_groups
|
for a in highlight_groups
|
||||||
if a == 'pythonDoctest'
|
if a ==# 'pythonDoctest'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@@ -144,38 +544,198 @@ function! jedi#do_popup_on_dot()
|
|||||||
for a in highlight_groups
|
for a in highlight_groups
|
||||||
for b in ['pythonString', 'pythonComment', 'pythonNumber']
|
for b in ['pythonString', 'pythonComment', 'pythonNumber']
|
||||||
if a == b
|
if a == b
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
return 1
|
return 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! jedi#configure_function_definition()
|
|
||||||
autocmd InsertLeave <buffer> Python jedi_vim.clear_func_def()
|
let s:show_call_signatures_last = [0, 0, '']
|
||||||
autocmd CursorMovedI <buffer> call jedi#show_func_def()
|
function! jedi#show_call_signatures() abort
|
||||||
|
if s:_init_python == 0
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let [line, col] = [line('.'), col('.')]
|
||||||
|
let curline = getline(line)
|
||||||
|
let reload_signatures = 1
|
||||||
|
|
||||||
|
" Caching. On the same line only.
|
||||||
|
if line == s:show_call_signatures_last[0]
|
||||||
|
" Check if the number of special signs before or after the
|
||||||
|
" cursor has not changed since the last call, which means that the
|
||||||
|
" argument position was not changed and we can skip repainting.
|
||||||
|
let prevcol = s:show_call_signatures_last[1]
|
||||||
|
let prevline = s:show_call_signatures_last[2]
|
||||||
|
let no_special = '[^,()=]'
|
||||||
|
if substitute(curline[:col-2], no_special, '', 'g')
|
||||||
|
\ == substitute(prevline[:prevcol-2], no_special, '', 'g')
|
||||||
|
\ && substitute(curline[(col-2):], no_special, '', 'g')
|
||||||
|
\ == substitute(prevline[(prevcol-2):], no_special, '', 'g')
|
||||||
|
let reload_signatures = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let s:show_call_signatures_last = [line, col, curline]
|
||||||
|
|
||||||
|
if reload_signatures
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
Python << PYTHONEOF
|
function! jedi#clear_call_signatures() abort
|
||||||
""" here we initialize the jedi stuff """
|
if s:_init_python == 0
|
||||||
import vim
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
# update the system path, to include the jedi path
|
let s:show_call_signatures_last = [0, 0, '']
|
||||||
import sys
|
python3 jedi_vim.clear_call_signatures()
|
||||||
import os
|
endfunction
|
||||||
sys.path.insert(0, os.path.join(vim.eval('expand("<sfile>:p:h:h")'), 'jedi'))
|
|
||||||
|
|
||||||
# to display errors correctly
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
# update the sys path to include the jedi_vim script
|
function! jedi#configure_call_signatures() abort
|
||||||
sys.path.insert(1, os.path.join(vim.eval('expand("<sfile>:p:h:h")'), 'plugin'))
|
augroup jedi_call_signatures
|
||||||
import jedi_vim
|
autocmd! * <buffer>
|
||||||
sys.path.pop(1)
|
if g:jedi#show_call_signatures == 2 " Command line call signatures
|
||||||
|
autocmd InsertEnter <buffer> let g:jedi#first_col = s:save_first_col()
|
||||||
|
endif
|
||||||
|
autocmd InsertEnter <buffer> let s:show_call_signatures_last = [0, 0, '']
|
||||||
|
autocmd InsertLeave <buffer> call jedi#clear_call_signatures()
|
||||||
|
if g:jedi#show_call_signatures_delay > 0
|
||||||
|
autocmd InsertEnter <buffer> let b:_jedi_orig_updatetime = &updatetime
|
||||||
|
\ | let &updatetime = g:jedi#show_call_signatures_delay
|
||||||
|
autocmd InsertLeave <buffer> if exists('b:_jedi_orig_updatetime')
|
||||||
|
\ | let &updatetime = b:_jedi_orig_updatetime
|
||||||
|
\ | unlet b:_jedi_orig_updatetime
|
||||||
|
\ | endif
|
||||||
|
autocmd CursorHoldI <buffer> call jedi#show_call_signatures()
|
||||||
|
else
|
||||||
|
autocmd CursorMovedI <buffer> call jedi#show_call_signatures()
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
endfunction
|
||||||
|
|
||||||
PYTHONEOF
|
|
||||||
"Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
" Determine where the current window is on the screen for displaying call
|
||||||
"Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
|
" signatures in the correct column.
|
||||||
|
function! s:save_first_col() abort
|
||||||
|
if bufname('%') ==# '[Command Line]' || winnr('$') == 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let startwin = winnr()
|
||||||
|
let winwidth = winwidth(0)
|
||||||
|
if winwidth == &columns
|
||||||
|
return 0
|
||||||
|
elseif winnr('$') == 2
|
||||||
|
return startwin == 1 ? 0 : (winwidth(1) + 1)
|
||||||
|
elseif winnr('$') == 3
|
||||||
|
if startwin == 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let ww1 = winwidth(1)
|
||||||
|
let ww2 = winwidth(2)
|
||||||
|
let ww3 = winwidth(3)
|
||||||
|
if ww1 + ww2 + ww3 + 2 == &columns
|
||||||
|
if startwin == 2
|
||||||
|
return ww1 + 1
|
||||||
|
else
|
||||||
|
return ww1 + ww2 + 2
|
||||||
|
endif
|
||||||
|
elseif startwin == 2
|
||||||
|
if ww2 + ww3 + 1 == &columns
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return ww1 + 1
|
||||||
|
endif
|
||||||
|
else " startwin == 3
|
||||||
|
if ww2 + ww3 + 1 == &columns
|
||||||
|
return ww2 + 1
|
||||||
|
else
|
||||||
|
return ww1 + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#complete_string(autocomplete) abort
|
||||||
|
if a:autocomplete
|
||||||
|
if !(g:jedi#popup_on_dot && jedi#do_popup_on_dot_in_highlight())
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:saved_completeopt = &completeopt
|
||||||
|
set completeopt-=longest
|
||||||
|
set completeopt+=menuone
|
||||||
|
set completeopt-=menu
|
||||||
|
if &completeopt !~# 'noinsert\|noselect'
|
||||||
|
" Patch 775 introduced noinsert and noselect, previously these
|
||||||
|
" options didn't exist. Setting them in earlier versions results in
|
||||||
|
" errors (E474).
|
||||||
|
if has('patch-7.4-775')
|
||||||
|
if g:jedi#popup_select_first
|
||||||
|
set completeopt+=noinsert
|
||||||
|
else
|
||||||
|
set completeopt+=noselect
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" To pass the tests we use this, it seems to get the closest to
|
||||||
|
" the other options. I'm really not sure if this properly
|
||||||
|
" works, but VIM 7.4-775 is already pretty old, so it might not
|
||||||
|
" be a problem anymore in a few years.
|
||||||
|
set completeopt+=longest
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
elseif pumvisible()
|
||||||
|
return "\<C-n>"
|
||||||
|
endif
|
||||||
|
return "\<C-x>\<C-o>\<C-r>=jedi#complete_opened(".a:autocomplete.")\<CR>"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#complete_opened(autocomplete) abort
|
||||||
|
if a:autocomplete
|
||||||
|
let &completeopt = s:saved_completeopt
|
||||||
|
unlet s:saved_completeopt
|
||||||
|
elseif pumvisible() && g:jedi#popup_select_first && stridx(&completeopt, 'longest') > -1
|
||||||
|
return "\<Down>"
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#smart_auto_mappings() abort
|
||||||
|
" Auto put import statement after from module.name<space> and complete
|
||||||
|
if search('\m^\s*from\s\+[A-Za-z0-9._]\{1,50}\%#\s*$', 'bcn', line('.'))
|
||||||
|
" Enter character and start completion.
|
||||||
|
return "\<space>import \<C-r>=jedi#complete_string(1)\<CR>"
|
||||||
|
endif
|
||||||
|
return "\<space>"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#setup_completion() abort
|
||||||
|
" We need our own omnifunc, so this overrides the omnifunc set by
|
||||||
|
" $VIMRUNTIME/ftplugin/python.vim.
|
||||||
|
setlocal omnifunc=jedi#completions
|
||||||
|
|
||||||
|
" map ctrl+space for autocompletion
|
||||||
|
if g:jedi#completions_command ==# '<C-Space>'
|
||||||
|
" In terminals, <C-Space> sometimes equals <Nul>.
|
||||||
|
imap <buffer> <Nul> <C-Space>
|
||||||
|
smap <buffer> <Nul> <C-Space>
|
||||||
|
endif
|
||||||
|
if len(g:jedi#completions_command)
|
||||||
|
execute 'inoremap <expr> <buffer> '.g:jedi#completions_command.' jedi#complete_string(0)'
|
||||||
|
" A separate mapping for select mode: deletes and completes.
|
||||||
|
execute 'snoremap <expr> <buffer> '.g:jedi#completions_command." '\<C-g>c'.jedi#complete_string(0)"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"python3 jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
||||||
|
"python3 jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
|
||||||
|
|
||||||
" vim: set et ts=4:
|
" vim: set et ts=4:
|
||||||
|
|||||||
7
codecov.yml
Normal file
7
codecov.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project: true
|
||||||
|
patch: true
|
||||||
|
changes: true
|
||||||
|
|
||||||
|
comment: off
|
||||||
594
doc/jedi-vim.txt
Normal file
594
doc/jedi-vim.txt
Normal file
@@ -0,0 +1,594 @@
|
|||||||
|
*jedi-vim.txt* - For Vim version 7.3 - Last change: 2014/07/29
|
||||||
|
__ _______ _______ __ ____ ____ __ .___ ___.~
|
||||||
|
| | | ____|| \ | | \ \ / / | | | \/ |~
|
||||||
|
| | | |__ | .--. || | _____\ \/ / | | | \ / |~
|
||||||
|
.--. | | | __| | | | || | |______\ / | | | |\/| |~
|
||||||
|
| `--' | | |____ | '--' || | \ / | | | | | |~
|
||||||
|
\______/ |_______||_______/ |__| \__/ |__| |__| |__|~
|
||||||
|
|
||||||
|
jedi-vim - awesome Python autocompletion with Vim
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Contents *jedi-vim-contents*
|
||||||
|
|
||||||
|
1. Introduction |jedi-vim-introduction|
|
||||||
|
2. Installation |jedi-vim-installation|
|
||||||
|
2.0. Requirements |jedi-vim-installation-requirements|
|
||||||
|
2.1. Manually |jedi-vim-installation-manually|
|
||||||
|
2.2. Using Pathogen |jedi-vim-installation-pathogen|
|
||||||
|
2.3. Using Vundle |jedi-vim-installation-vundle|
|
||||||
|
2.4. Installing from Repositories |jedi-vim-installation-repos|
|
||||||
|
3. Supported Python features |jedi-vim-support|
|
||||||
|
4. Usage |jedi-vim-usage|
|
||||||
|
5. Mappings |jedi-vim-keybindings|
|
||||||
|
5.1. Start completion |g:jedi#completions_command|
|
||||||
|
5.2. Go to definition |g:jedi#goto_command|
|
||||||
|
5.3. Go to assignment |g:jedi#goto_assignments_command|
|
||||||
|
5.4 Go to stub |g:jedi#goto_stubs_command|
|
||||||
|
5.5. Show documentation |g:jedi#documentation_command|
|
||||||
|
5.6. Rename variables |g:jedi#rename_command|
|
||||||
|
5.7. Rename variables (Reuse name) |g:jedi#rename_command_keep_name|
|
||||||
|
5.8. Show name usages |g:jedi#usages_command|
|
||||||
|
5.9. Open module by name |:Pyimport|
|
||||||
|
6. Configuration |jedi-vim-configuration|
|
||||||
|
6.1. auto_initialization |g:jedi#auto_initialization|
|
||||||
|
6.2. auto_vim_configuration |g:jedi#auto_vim_configuration|
|
||||||
|
6.3. popup_on_dot |g:jedi#popup_on_dot|
|
||||||
|
6.4. popup_select_first |g:jedi#popup_select_first|
|
||||||
|
6.5. auto_close_doc |g:jedi#auto_close_doc|
|
||||||
|
6.6. show_call_signatures |g:jedi#show_call_signatures|
|
||||||
|
6.7. show_call_signatures_delay |g:jedi#show_call_signatures_delay|
|
||||||
|
6.8. use_tabs_not_buffers |g:jedi#use_tabs_not_buffers|
|
||||||
|
6.9. squelch_py_warning |g:jedi#squelch_py_warning|
|
||||||
|
6.10. completions_enabled |g:jedi#completions_enabled|
|
||||||
|
6.11. use_splits_not_buffers |g:jedi#use_splits_not_buffers|
|
||||||
|
6.12. force_py_version |g:jedi#force_py_version|
|
||||||
|
6.13. smart_auto_mappings |g:jedi#smart_auto_mappings|
|
||||||
|
6.14. use_tag_stack |g:jedi#use_tag_stack|
|
||||||
|
6.15. environment_path |g:jedi#environment_path|
|
||||||
|
|b:jedi_environment_path|
|
||||||
|
6.16. added_sys_path |g:jedi#added_sys_path|
|
||||||
|
|b:jedi_added_sys_path|
|
||||||
|
6.17. case_insensitive_completion |g:jedi#case_insensitive_completion|
|
||||||
|
|b:jedi_case_insensitive_completion|
|
||||||
|
7. Testing |jedi-vim-testing|
|
||||||
|
8. Contributing |jedi-vim-contributing|
|
||||||
|
9. License |jedi-vim-license|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Introduction *jedi-vim-introduction*
|
||||||
|
|
||||||
|
Jedi-vim is a Vim binding to the awesome Python autocompletion library
|
||||||
|
`jedi`. Among jedi's (and, therefore, jedi-vim's) features are:
|
||||||
|
|
||||||
|
- Completion for a wide array of Python features (see |jedi-vim-support|)
|
||||||
|
- Robust in dealing with syntax errors and wrong indentation
|
||||||
|
- Parses complex module/function/class structures
|
||||||
|
- Infers function arguments from Sphinx/Epydoc strings
|
||||||
|
- Doesn't execute Python code
|
||||||
|
- Supports Virtualenv
|
||||||
|
- Supports Python 2.7 and 3.4+
|
||||||
|
|
||||||
|
By leveraging this library, jedi-vim adds the following capabilities to Vim:
|
||||||
|
|
||||||
|
- Displaying function/class bodies
|
||||||
|
- "Go to definition" command
|
||||||
|
- Displaying docstrings
|
||||||
|
- Renaming and refactoring
|
||||||
|
- Looking up related names
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
2. Installation *jedi-vim-installation*
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.0. Requirements *jedi-vim-installation-requirements*
|
||||||
|
|
||||||
|
First of all, jedi-vim requires Vim to be compiled with the `+python` option.
|
||||||
|
|
||||||
|
It is best if you have VIM >= 7.3, compiled with the `+conceal` option. With
|
||||||
|
older versions, you will probably not see the parameter recommendation list
|
||||||
|
for functions after typing the open bracket. Some platforms (including OS X
|
||||||
|
releases) do not ship a VIM with `+conceal`. You can check if your VIM has the
|
||||||
|
feature with >
|
||||||
|
|
||||||
|
:ver
|
||||||
|
|
||||||
|
and look for "`+conceal`" (as opposed to "`-conceal`") or >
|
||||||
|
|
||||||
|
:echo has('conceal')
|
||||||
|
|
||||||
|
which will report 0 (not included) or 1 (included). If your VIM lacks this
|
||||||
|
feature and you would like function parameter completion, you will need to
|
||||||
|
build your own VIM, or use a package for your operating system that has this
|
||||||
|
feature (such as MacVim on OS X, which also contains a console binary).
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.1. Installing manually *jedi-vim-installation-manually*
|
||||||
|
|
||||||
|
1. If you want to install jedi as a submodule instead, issue this command: >
|
||||||
|
|
||||||
|
git clone --recursive http://github.com/davidhalter/jedi-vim
|
||||||
|
|
||||||
|
2. Put the plugin files into their respective folders in your vim runtime
|
||||||
|
directory (usually ~/.vim). Be sure to pay attention to the directory
|
||||||
|
structure!
|
||||||
|
3. Update the Vim help tags with >
|
||||||
|
|
||||||
|
:helptags <path/to/vimruntime>/doc
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2. Installing using Pathogen *jedi-vim-installation-pathogen*
|
||||||
|
|
||||||
|
Pathogen simplifies installation considerably.
|
||||||
|
|
||||||
|
1.a Clone the git repository into your bundles directory: >
|
||||||
|
|
||||||
|
git clone http://github.com/davidhalter/jedi-vim path/to/bundles/jedi-vim
|
||||||
|
|
||||||
|
1b. Again, if you want to install jedi as a submodule, use this command
|
||||||
|
instead: >
|
||||||
|
|
||||||
|
git clone --recursive http://github.com/davidhalter/jedi-vim
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.3. Installing using Vundle *jedi-vim-installation-vundle*
|
||||||
|
|
||||||
|
1. Vundle automatically downloads subrepositories as git submodules, so you
|
||||||
|
will automatically get the jedi library with the jedi-vim plugin. Add the
|
||||||
|
following to the Bundles section in your .vimrc file: >
|
||||||
|
|
||||||
|
Plugin 'davidhalter/jedi-vim'
|
||||||
|
|
||||||
|
2. Issue the following command in Vim: >
|
||||||
|
|
||||||
|
:PluginInstall
|
||||||
|
|
||||||
|
Help tags are generated automatically, so you should be good to go.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.4. Installing from Repositories *jedi-vim-installation-repos*
|
||||||
|
|
||||||
|
Some Linux distributions have jedi-vim packages in their official
|
||||||
|
repositories. On Arch Linux, install vim-jedi. On Debian (8+) or Ubuntu
|
||||||
|
(14.04+) install vim-python-jedi.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
3. Supported Python features *jedi-vim-support*
|
||||||
|
|
||||||
|
The Jedi library does all the hard work behind the scenes. It understands most
|
||||||
|
Python features, among them:
|
||||||
|
|
||||||
|
- Builtins
|
||||||
|
- Multiple `return`s or `yield`s
|
||||||
|
- Tuple assignments/array indexing/dictionary indexing
|
||||||
|
- `with`-statement/exception handling
|
||||||
|
- `*args` and `**kwargs`
|
||||||
|
- Decorators, lambdas, closures
|
||||||
|
- Generators, iterators
|
||||||
|
- Some descriptors: `property`/`staticmethod`/`classmethod`
|
||||||
|
- Some magic methods: `__call__`, `__iter__`, `__next__`, `__get__`,
|
||||||
|
`__getitem__`, `__init__`
|
||||||
|
- `list.append()`, `set.add()`, `list.extend()`, etc.
|
||||||
|
- (Nested) list comprehensions and ternary expressions
|
||||||
|
- Relative `import`s
|
||||||
|
- `getattr()`/`__getattr__`/`__getattribute__`
|
||||||
|
- Function annotations (py3k feature, are being ignored at the moment, but are
|
||||||
|
parsed)
|
||||||
|
- Class decorators (py3k feature, are being ignored at the moment, but are
|
||||||
|
parsed)
|
||||||
|
- Simple/usual `sys.path` modifications
|
||||||
|
- `isinstance` checks for `if`/`while`/`assert` case, that doesn't work with
|
||||||
|
Jedi
|
||||||
|
- Stubs
|
||||||
|
- And more...
|
||||||
|
|
||||||
|
Note: This list is not necessarily up to date. For a complete list of
|
||||||
|
features, please refer to the Jedi documentation at
|
||||||
|
http://jedi.readthedocs.io.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
4. Usage *jedi-vim-usage*
|
||||||
|
|
||||||
|
With the default settings, autocompletion can be triggered by typing
|
||||||
|
<Ctrl-Space>. The first entry will automatically be selected, so you can press
|
||||||
|
<Return> to insert it into your code or keep typing and narrow down your
|
||||||
|
completion options. The usual <C-X><C-O> and <C-P>/<C-N> keybindings work as
|
||||||
|
well. Autocompletion is also triggered by typing a period in insert mode.
|
||||||
|
Since periods rarely occur in Python code outside of method/import lookups,
|
||||||
|
this is handy to have (but can be disabled).
|
||||||
|
|
||||||
|
When it encounters a new module, jedi might take a few seconds to parse that
|
||||||
|
module's contents. Afterwards, the contents are cached and completion will be
|
||||||
|
almost instantaneous.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
5. Key Bindings *jedi-vim-keybindings*
|
||||||
|
|
||||||
|
All keybindings can be mapped by setting the appropriate global option. For
|
||||||
|
example, to set the keybinding for starting omnicompletion to <C-N> instead of
|
||||||
|
<Ctrl-Space>, add the following setting to your .vimrc file: >
|
||||||
|
|
||||||
|
let g:jedi#completions_command = "<C-N>"
|
||||||
|
|
||||||
|
Note: If you have |g:jedi#auto_initialization| set to 0, you have to create
|
||||||
|
a mapping yourself by calling a function: >
|
||||||
|
|
||||||
|
" Using <C-N> for omnicompletion
|
||||||
|
inoremap <silent> <buffer> <C-N> <c-x><c-o>
|
||||||
|
" Use <localleader>r (by default <\-r>) for renaming
|
||||||
|
nnoremap <silent> <buffer> <localleader>r :call jedi#rename()<cr>
|
||||||
|
" etc.
|
||||||
|
|
||||||
|
Note: You can set commands to '', which means that they are empty and not
|
||||||
|
assigned. It's an easy way to "disable" functionality of jedi-vim.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.1. `g:jedi#completions_command` *g:jedi#completions_command*
|
||||||
|
Function: n/a; see above
|
||||||
|
Default: <Ctrl-Space> Start completion
|
||||||
|
|
||||||
|
Performs autocompletion (or omnicompletion, to be precise).
|
||||||
|
|
||||||
|
Note: If you want to use <Tab> for completion, please install Supertab:
|
||||||
|
https://github.com/ervandew/supertab.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.2. `g:jedi#goto_command` *g:jedi#goto_command*
|
||||||
|
Function: `jedi#goto()`
|
||||||
|
Default: <leader>d Go to definition (or assignment)
|
||||||
|
|
||||||
|
This function first tries |jedi#goto_definitions|, and falls back to
|
||||||
|
|jedi#goto_assignments| for builtin modules. It produces an error if nothing
|
||||||
|
could be found.
|
||||||
|
NOTE: this implementation is subject to change.
|
||||||
|
Ref: https://github.com/davidhalter/jedi/issues/570
|
||||||
|
|
||||||
|
This command tries to find the original definition of the function/class under
|
||||||
|
the cursor. Just like the `jedi#goto_assignments()` function, it does not work
|
||||||
|
if the definition isn't in a Python source file.
|
||||||
|
|
||||||
|
The difference between `jedi#goto_assignments()` and `jedi#goto_definitions()`
|
||||||
|
is that the latter performs recursive lookups. Take, for example, the
|
||||||
|
following module structure: >
|
||||||
|
|
||||||
|
# file1.py:
|
||||||
|
from file2 import foo
|
||||||
|
|
||||||
|
# file2.py:
|
||||||
|
from file3 import bar as foo
|
||||||
|
|
||||||
|
# file3.py
|
||||||
|
def bar():
|
||||||
|
pass
|
||||||
|
|
||||||
|
The `jedi#goto_assignments()` function will take you to the >
|
||||||
|
|
||||||
|
from file2 import foo
|
||||||
|
|
||||||
|
statement in file1.py, while the `jedi#goto_definitions()` function will take
|
||||||
|
you all the way to the >
|
||||||
|
|
||||||
|
def bar():
|
||||||
|
|
||||||
|
line in file3.py.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.3. `g:jedi#goto_assignments_command` *g:jedi#goto_assignments_command*
|
||||||
|
Function: `jedi#goto_assignments()`
|
||||||
|
Default: <leader>g Go to assignment
|
||||||
|
|
||||||
|
This function finds the first definition of the function/class under the
|
||||||
|
cursor. It produces an error if the definition is not in a Python file.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.4. `g:jedi#goto_stubs_command` *g:jedi#goto_stubs_command*
|
||||||
|
Function: `jedi#goto_stubs()`
|
||||||
|
Default: <leader>s Go to stub
|
||||||
|
|
||||||
|
Finds the stub of the function/class under the cursor.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.5. `g:jedi#documentation_command` *g:jedi#documentation_command*
|
||||||
|
Function: `jedi#show_documentation()`
|
||||||
|
Default: <K> Show pydoc documentation
|
||||||
|
|
||||||
|
This shows the pydoc documentation for the item currently under the cursor.
|
||||||
|
The documentation is opened in a horizontally split buffer. The height of this
|
||||||
|
buffer is controlled by `g:jedi#max_doc_height` (set by default to 30).
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.6. `g:jedi#rename_command` *g:jedi#rename_command*
|
||||||
|
Function: `jedi#rename()`
|
||||||
|
Default: <leader>r Rename variables
|
||||||
|
|
||||||
|
Jedi-vim deletes the word currently under the cursor and puts Vim in insert
|
||||||
|
mode, where the user is expected to enter the new variable name. Upon leaving
|
||||||
|
insert mode, jedi-vim then renames all occurrences of the old variable name
|
||||||
|
with the new one. The number of performed renames is displayed in the command
|
||||||
|
line.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.7. `g:jedi#rename_command_keep_name` *g:jedi#rename_command_keep_name*
|
||||||
|
Function: `jedi#rename()`
|
||||||
|
Default: <leader>R Rename variables
|
||||||
|
(This key mapping does not delete the word under the cursor)
|
||||||
|
|
||||||
|
Jedi-vim keeps the word currently under the cursor, moves the cursor to the end
|
||||||
|
of the word, and puts Vim in insert mode, where the user is expected to enter
|
||||||
|
the new variable name. Upon leaving insert mode, Jedi-vim then renames all
|
||||||
|
occurrences of the old variable name with the new one. The number of performed
|
||||||
|
renames is displayed in the command line.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.8. `g:jedi#usages_command` *g:jedi#usages_command*
|
||||||
|
Function: `jedi#usages()`
|
||||||
|
Default: <leader>n Show usages of a name.
|
||||||
|
|
||||||
|
The quickfix window is populated with a list of all names which point to the
|
||||||
|
definition of the name under the cursor.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.9. Open module by name *:Pyimport*
|
||||||
|
Function: `jedi#py_import(args)`
|
||||||
|
Default: :Pyimport e.g. `:Pyimport os` shows os.py in VIM.
|
||||||
|
|
||||||
|
Simulate an import and open that module in VIM.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
6. Configuration *jedi-vim-configuration*
|
||||||
|
|
||||||
|
Note: You currently have to set these options in your .vimrc. Setting them in
|
||||||
|
an ftplugin (e.g. ~/.vim/ftplugin/python/jedi-vim-settings.vim) will not work
|
||||||
|
because jedi-vim is not set up as an filetype plugin, but as a "regular"
|
||||||
|
plugin.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.1. `g:jedi#auto_initialization` *g:jedi#auto_initialization*
|
||||||
|
|
||||||
|
Upon initialization, jedi-vim performs the following steps:
|
||||||
|
|
||||||
|
1. Set the current buffers 'omnifunc' to its own completion function
|
||||||
|
`jedi#completions`
|
||||||
|
2. Create mappings to commands specified in |jedi-vim-keybindings|
|
||||||
|
3. Call `jedi#configure_call_signatures()` if
|
||||||
|
`g:jedi#show_call_signatures` is set
|
||||||
|
|
||||||
|
You can disable the default initialization routine by setting this option to
|
||||||
|
0. Beware that you have to perform the above steps yourself, though.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (Perform automatic initialization)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.2. `g:jedi#auto_vim_configuration` *g:jedi#auto_vim_configuration*
|
||||||
|
|
||||||
|
Jedi-vim sets 'completeopt' to `menuone,longest` and `popup` (for Vim version
|
||||||
|
numbers higher than 8.1.1882) respectively `preview` by default, if
|
||||||
|
'completeopt' is not changed from Vim's default.
|
||||||
|
It also remaps <Ctrl-C> to <Esc> in insert mode.
|
||||||
|
|
||||||
|
If you want to keep your own configuration, disable this setting.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (Set 'completeopt' and mapping as described above)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.3. `g:jedi#popup_on_dot` *g:jedi#popup_on_dot*
|
||||||
|
|
||||||
|
Jedi-vim automatically starts completion upon typing a period in insert mode.
|
||||||
|
|
||||||
|
However, when working with large modules, this can slow down your typing flow
|
||||||
|
since you have to wait for jedi to parse the module and show the completion
|
||||||
|
menu. By disabling this setting, completion is only started when you manually
|
||||||
|
press the completion key.
|
||||||
|
You need to also have `g:jedi#completions_enabled` enabled for this.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (Start completion on typing a period)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.4. `g:jedi#popup_select_first` *g:jedi#popup_select_first*
|
||||||
|
|
||||||
|
Upon starting completion, jedi-vim can automatically select the first entry
|
||||||
|
that pops up (without actually inserting it).
|
||||||
|
|
||||||
|
This leads to a better typing flow: As you type more characters, the entries
|
||||||
|
in the completion menu are narrowed down. If they are narrowed down enough,
|
||||||
|
you can just press <Return> to insert the first match.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (Automatically select first completion entry)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.5. `g:jedi#auto_close_doc` *g:jedi#auto_close_doc*
|
||||||
|
|
||||||
|
When doing completion and jedi-vim shows the docstring of the currently selected
|
||||||
|
item in a preview (not a popup) window, this window is being closed after
|
||||||
|
insertion of a completion item.
|
||||||
|
|
||||||
|
Set this to 0 to leave the preview window open even after leaving insert mode.
|
||||||
|
This could be useful if you want to browse longer docstrings.
|
||||||
|
|
||||||
|
This setting is ignored if a popup instead of a preview window is used.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (Automatically close preview window upon leaving insert mode)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.6. `g:jedi#show_call_signatures` *g:jedi#show_call_signatures*
|
||||||
|
|
||||||
|
Jedi-vim can display a small window detailing the arguments of the currently
|
||||||
|
completed function and highlighting the currently selected argument. This can
|
||||||
|
be disabled by setting this option to 0. Setting this option to 2 shows call
|
||||||
|
signatures in the command line instead of a popup window.
|
||||||
|
|
||||||
|
Options: 0, 1, or 2
|
||||||
|
Default: 1 (Show call signatures window)
|
||||||
|
|
||||||
|
Note: 'showmode' must be disabled for command line call signatures to be
|
||||||
|
visible.
|
||||||
|
|
||||||
|
Note: This setting is ignored if |g:jedi#auto_initialization| is set to 0. In
|
||||||
|
that case, if you want to see call signatures, you have to set it up
|
||||||
|
manually by calling a function in your configuration file: >
|
||||||
|
|
||||||
|
call jedi#configure_call_signatures()
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.7. `g:jedi#show_call_signatures_delay` *g:jedi#show_call_signatures_delay*
|
||||||
|
|
||||||
|
The delay to be used with |g:jedi#show_call_signatures|. If it is greater
|
||||||
|
than 0 it will use Vim's |CursorHoldI| event instead of |CursorMovedI|.
|
||||||
|
It will temporarily set Vim's |'updatetime'| option during insert mode.
|
||||||
|
|
||||||
|
Options: delay in milliseconds
|
||||||
|
Default: 500
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.8. `g:jedi#use_tabs_not_buffers` *g:jedi#use_tabs_not_buffers*
|
||||||
|
|
||||||
|
You can make jedi-vim open a new tab if you use the "go to", "show
|
||||||
|
definition", or "related names" commands. When you leave this at the default
|
||||||
|
(0), they open in the current window instead.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 0 (Command output reuses current window)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.9. `g:jedi#squelch_py_warning` *g:jedi#squelch_py_warning*
|
||||||
|
|
||||||
|
When Vim has not been compiled with +python, jedi-vim shows a warning to that
|
||||||
|
effect and aborts loading itself. Set this to 1 to suppress that warning.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 0 (Warning is shown)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.10. `g:jedi#completions_enabled` *g:jedi#completions_enabled*
|
||||||
|
|
||||||
|
If you don't want Jedi completion, but all the other features, you can disable
|
||||||
|
it in favor of another completion engine (that probably also uses Jedi, like
|
||||||
|
YCM).
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.11. `g:jedi#use_splits_not_buffers` *g:jedi#use_splits_not_buffers*
|
||||||
|
|
||||||
|
If you want to open new split for "go to", you could set this option to the
|
||||||
|
direction which you want to open a split with.
|
||||||
|
|
||||||
|
Options: top, left, right, bottom or winwidth
|
||||||
|
Default: "" (not enabled by default)
|
||||||
|
|
||||||
|
Note: with the 'winwidth' option the window is split vertically or horizontally
|
||||||
|
depending on the width of the window relative to 'textwidth'. This essentially
|
||||||
|
means that if the window is big enough it will be split vertically but if it is
|
||||||
|
small a horizontal split happens.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.12. `g:jedi#force_py_version` *g:jedi#force_py_version*
|
||||||
|
|
||||||
|
If you have installed multiple Python versions, you can force the Python
|
||||||
|
version that is going to be used.
|
||||||
|
You don't have to compile VIM with multiple Python versions.
|
||||||
|
The variable can be set in the .vimrc like this to force python 2:
|
||||||
|
|
||||||
|
let g:jedi#force_py_version = 2
|
||||||
|
|
||||||
|
By default jedi loads the latest Python version installed on your system that
|
||||||
|
can be found.
|
||||||
|
|
||||||
|
This variable can be changed during runtime.
|
||||||
|
|
||||||
|
Options: 2, 2.7, 3, 3.5, 3.6, ...
|
||||||
|
Default: "auto"
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.13. `g:jedi#smart_auto_mappings` *g:jedi#smart_auto_mappings*
|
||||||
|
|
||||||
|
When you start typing `from module.name<space>` jedi-vim automatically
|
||||||
|
can add the "import" statement and trigger the autocompletion popup.
|
||||||
|
|
||||||
|
You can enable this using: >
|
||||||
|
|
||||||
|
let g:jedi#smart_auto_mappings = 1
|
||||||
|
<
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 0 (disabled by default)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.14. `g:jedi#use_tag_stack` *g:jedi#use_tag_stack*
|
||||||
|
|
||||||
|
Write results of |jedi#goto| to a temporary file and use the |:tjump| command
|
||||||
|
to enable full |tagstack| functionality. Use of the tag stack allows
|
||||||
|
returning to the usage of a function with CTRL-T after exploring the
|
||||||
|
definition with arbitrary changes to the |jumplist|.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (enabled by default)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.15. `g:jedi#environment_path` *g:jedi#environment_path*
|
||||||
|
*b:jedi_environment_path*
|
||||||
|
|
||||||
|
To use a specific virtualenv or a specific Python version it is possible to
|
||||||
|
set an interpreter.
|
||||||
|
|
||||||
|
Both setting the directory and setting a project is working.
|
||||||
|
|
||||||
|
Examples: "/usr/bin/python3.9", "venv", "../venv", "../venv/bin/python"
|
||||||
|
|
||||||
|
The buffer-local variable `b:jedi_environment_path` can be used to override the
|
||||||
|
global variable `g:jedi#environment_path`.
|
||||||
|
|
||||||
|
Default: "auto"
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.16. `g:jedi#added_sys_path` *g:jedi#added_sys_path*
|
||||||
|
*b:jedi_added_sys_path*
|
||||||
|
|
||||||
|
To add extra sys_path.
|
||||||
|
|
||||||
|
The buffer-local variable `b:jedi_added_sys_path` can be used to add
|
||||||
|
additional extra sys_path.
|
||||||
|
|
||||||
|
Examples: ["../site-packages"]
|
||||||
|
Default: []
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.17. `g:jedi#case_insensitive_completion` *g:jedi#case_insensitive_completion*
|
||||||
|
*b:jedi_case_insensitive_completion*
|
||||||
|
|
||||||
|
0 to disable case insensitive completion.
|
||||||
|
1 to enable case insensitive completion (default).
|
||||||
|
|
||||||
|
The buffer-local variable `b:jedi_case_insensitive_completion` can be used to
|
||||||
|
override the global variable `g:jedi#case_insensitive_completion`.
|
||||||
|
|
||||||
|
Default: 1
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
7. Testing *jedi-vim-testing*
|
||||||
|
|
||||||
|
jedi-vim is being tested with a combination of vspec
|
||||||
|
https://github.com/kana/vim-vspec and py.test http://pytest.org/.
|
||||||
|
|
||||||
|
The tests are in the test subdirectory, you can run them calling::
|
||||||
|
|
||||||
|
py.test
|
||||||
|
|
||||||
|
The tests are automatically run with `travis
|
||||||
|
<https://travis-ci.org/davidhalter/jedi-vim>`_.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
8. Contributing *jedi-vim-contributing*
|
||||||
|
|
||||||
|
We love Pull Requests! Read the instructions in `CONTRIBUTING.md`.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
9. License *jedi-vim-license*
|
||||||
|
|
||||||
|
Jedi-vim is licensed with the MIT license.
|
||||||
|
|
||||||
|
vim: textwidth=78 et filetype=help:norightleft:
|
||||||
140
doc/logotype-a.svg
Normal file
140
doc/logotype-a.svg
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="897.845px" height="247.51px" viewBox="0 0 897.845 247.51" enable-background="new 0 0 897.845 247.51"
|
||||||
|
xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="287.3965" y1="65.2686" x2="287.3965" y2="106.4546">
|
||||||
|
<stop offset="0" style="stop-color:#E27817"/>
|
||||||
|
<stop offset="0.3906" style="stop-color:#E47519"/>
|
||||||
|
<stop offset="0.7116" style="stop-color:#E96B1F"/>
|
||||||
|
<stop offset="1" style="stop-color:#F15A29"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_1_)" points="285.068,66.556 272.054,95.664 302.739,95.664 302.739,66.556 "/>
|
||||||
|
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="216.8877" y1="65.2686" x2="216.8877" y2="106.4546">
|
||||||
|
<stop offset="0" style="stop-color:#E27817"/>
|
||||||
|
<stop offset="0.3906" style="stop-color:#E47519"/>
|
||||||
|
<stop offset="0.7116" style="stop-color:#E96B1F"/>
|
||||||
|
<stop offset="1" style="stop-color:#F15A29"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_2_)" points="180.483,95.664 193.893,95.664 240.172,95.664 253.292,66.556 180.483,66.556 "/>
|
||||||
|
<g>
|
||||||
|
<polygon fill="#019733" points="256.464,59.293 253.603,65.696 253.593,65.696 253.197,66.592 240.172,95.7 215.738,150.321
|
||||||
|
199.788,185.978 231.676,185.978 231.676,185.969 272.071,95.7 275.634,87.737 285.089,66.592 288.355,59.293 "/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<polygon fill="#019733" points="215.738,150.321 194.605,95.7 180.483,95.7 180.483,135.118 199.788,185.969 199.788,185.978
|
||||||
|
"/>
|
||||||
|
</g>
|
||||||
|
<path fill="#019733" d="M151.355,59.294v100.005h-28.989h-11.292v-7.972c3.644-4.232,6.749-9.936,6.749-16.218
|
||||||
|
c0-2.846-0.456-5.578-1.294-8.104h0.011l-4.274-12.151c-0.238-1.16-0.633-2.257-1.15-3.281v-0.032l-5.878-11.59
|
||||||
|
c-1.201-2.808-3.975-4.897-7.34-5.362c0.281-4.969,2.837-8.87,5.932-8.87l-3.137-1.004l3.137-3.033
|
||||||
|
c-5.01,0-9.098,5.775-9.388,13.021c-3.116,0.609-5.672,2.598-6.79,5.258l-5.723,11.271c-0.052,0.104-0.104,0.197-0.155,0.3v0.01
|
||||||
|
c-0.528,1.057-0.932,2.174-1.169,3.344l-4.232,12.079c-0.012,0.02-0.012,0.03-0.021,0.042c-0.828,2.525-1.294,5.258-1.294,8.104
|
||||||
|
c0,6.282,3.25,11.985,6.904,16.218v35.616h29.112h11.294h58.105V59.294H151.355z M86.554,117.834
|
||||||
|
c-0.673,2.019-2.442,3.252-3.954,2.744c-1.51-0.508-2.194-2.547-1.521-4.565c0.673-2.017,2.443-3.25,3.953-2.742
|
||||||
|
C86.544,113.777,87.228,115.817,86.554,117.834z M110.163,120.578c-1.51,0.508-3.27-0.726-3.954-2.744
|
||||||
|
c-0.672-2.017,0.011-4.057,1.521-4.563c1.512-0.508,3.282,0.726,3.955,2.742C112.357,118.031,111.674,120.07,110.163,120.578z"/>
|
||||||
|
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="134.6348" y1="65.2686" x2="134.6348" y2="106.4546">
|
||||||
|
<stop offset="0" style="stop-color:#E27817"/>
|
||||||
|
<stop offset="0.3906" style="stop-color:#E47519"/>
|
||||||
|
<stop offset="0.7116" style="stop-color:#E96B1F"/>
|
||||||
|
<stop offset="1" style="stop-color:#F15A29"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_3_)" points="151.292,66.556 117.914,66.556 117.914,95.664 145.981,95.664 151.292,95.664
|
||||||
|
151.355,95.664 151.355,66.592 151.292,66.592 "/>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="244.0713" y1="198.6924" x2="244.0713" y2="111.1674">
|
||||||
|
<stop offset="0" style="stop-color:#019733"/>
|
||||||
|
<stop offset="0.1363" style="stop-color:#0B732D;stop-opacity:0.8637"/>
|
||||||
|
<stop offset="0.2826" style="stop-color:#145529;stop-opacity:0.7174"/>
|
||||||
|
<stop offset="0.4366" style="stop-color:#1A3D25;stop-opacity:0.5634"/>
|
||||||
|
<stop offset="0.5997" style="stop-color:#1F2C22;stop-opacity:0.4003"/>
|
||||||
|
<stop offset="0.778" style="stop-color:#222221;stop-opacity:0.222"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20;stop-opacity:0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_4_)" points="256.464,59.293 253.603,65.696 253.593,65.696 253.197,66.592 240.172,95.7
|
||||||
|
215.738,150.321 199.788,185.978 231.676,185.978 231.676,185.969 272.071,95.7 275.634,87.737 285.089,66.592 288.355,59.293
|
||||||
|
"/>
|
||||||
|
</g>
|
||||||
|
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="165.9131" y1="41.1123" x2="165.9131" y2="128.6277">
|
||||||
|
<stop offset="0" style="stop-color:#019733"/>
|
||||||
|
<stop offset="0.1363" style="stop-color:#0B732D;stop-opacity:0.8637"/>
|
||||||
|
<stop offset="0.2826" style="stop-color:#145529;stop-opacity:0.7174"/>
|
||||||
|
<stop offset="0.4366" style="stop-color:#1A3D25;stop-opacity:0.5634"/>
|
||||||
|
<stop offset="0.5997" style="stop-color:#1F2C22;stop-opacity:0.4003"/>
|
||||||
|
<stop offset="0.778" style="stop-color:#222221;stop-opacity:0.222"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20;stop-opacity:0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<rect x="151.355" y="59.294" opacity="0.5" fill="url(#SVGID_5_)" width="29.116" height="127.649"/>
|
||||||
|
<g opacity="0.58">
|
||||||
|
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="198.1104" y1="83.4141" x2="198.1104" y2="154.2879">
|
||||||
|
<stop offset="0" style="stop-color:#019733"/>
|
||||||
|
<stop offset="0.0409" style="stop-color:#038E32;stop-opacity:0.9591"/>
|
||||||
|
<stop offset="0.2465" style="stop-color:#0F662B;stop-opacity:0.7535"/>
|
||||||
|
<stop offset="0.4491" style="stop-color:#184726;stop-opacity:0.5509"/>
|
||||||
|
<stop offset="0.6453" style="stop-color:#1E3123;stop-opacity:0.3547"/>
|
||||||
|
<stop offset="0.8322" style="stop-color:#222421;stop-opacity:0.1678"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20;stop-opacity:0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_6_)" points="215.738,150.321 194.605,95.7 180.483,95.7 180.483,135.118 199.788,185.969
|
||||||
|
199.788,185.978 "/>
|
||||||
|
</g>
|
||||||
|
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="127.7627" y1="192.1367" x2="127.7627" y2="137.5901">
|
||||||
|
<stop offset="0" style="stop-color:#019733"/>
|
||||||
|
<stop offset="0.0409" style="stop-color:#038E32;stop-opacity:0.9591"/>
|
||||||
|
<stop offset="0.2465" style="stop-color:#0F662B;stop-opacity:0.7535"/>
|
||||||
|
<stop offset="0.4491" style="stop-color:#184726;stop-opacity:0.5509"/>
|
||||||
|
<stop offset="0.6453" style="stop-color:#1E3123;stop-opacity:0.3547"/>
|
||||||
|
<stop offset="0.8322" style="stop-color:#222421;stop-opacity:0.1678"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20;stop-opacity:0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path opacity="0.6" fill="url(#SVGID_7_)" d="M151.355,59.294v100.005h-28.989h-11.292v-7.972
|
||||||
|
c3.644-4.232,6.749-9.936,6.749-16.218c0-2.846-0.456-5.578-1.294-8.104h0.011l-4.274-12.151c-0.238-1.16-0.633-2.257-1.15-3.281
|
||||||
|
v-0.032l-5.878-11.59c-1.201-2.808-3.975-4.897-7.34-5.362c0.281-4.969,2.837-8.87,5.932-8.87l-3.137-1.004l3.137-3.033
|
||||||
|
c-5.01,0-9.098,5.775-9.388,13.021c-3.116,0.609-5.672,2.598-6.79,5.258l-5.723,11.271c-0.052,0.104-0.104,0.197-0.155,0.3v0.01
|
||||||
|
c-0.528,1.057-0.932,2.174-1.169,3.344l-4.232,12.079c-0.012,0.02-0.012,0.03-0.021,0.042c-0.828,2.525-1.294,5.258-1.294,8.104
|
||||||
|
c0,6.282,3.25,11.985,6.904,16.218v35.616h29.112h11.294h58.105V59.294H151.355z M86.554,117.834
|
||||||
|
c-0.673,2.019-2.442,3.252-3.954,2.744c-1.51-0.508-2.194-2.547-1.521-4.565c0.673-2.017,2.443-3.25,3.953-2.742
|
||||||
|
C86.544,113.777,87.228,115.817,86.554,117.834z M110.163,120.578c-1.51,0.508-3.27-0.726-3.954-2.744
|
||||||
|
c-0.672-2.017,0.011-4.057,1.521-4.563c1.512-0.508,3.282,0.726,3.955,2.742C112.357,118.031,111.674,120.07,110.163,120.578z"/>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="244.0713" y1="53.3584" x2="244.0713" y2="78.0277">
|
||||||
|
<stop offset="0" style="stop-color:#019733"/>
|
||||||
|
<stop offset="0.1363" style="stop-color:#0B732D;stop-opacity:0.8637"/>
|
||||||
|
<stop offset="0.2826" style="stop-color:#145529;stop-opacity:0.7174"/>
|
||||||
|
<stop offset="0.4366" style="stop-color:#1A3D25;stop-opacity:0.5634"/>
|
||||||
|
<stop offset="0.5997" style="stop-color:#1F2C22;stop-opacity:0.4003"/>
|
||||||
|
<stop offset="0.778" style="stop-color:#222221;stop-opacity:0.222"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20;stop-opacity:0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<polygon fill="url(#SVGID_8_)" points="256.464,59.293 253.603,65.696 253.593,65.696 253.197,66.592 240.172,95.7
|
||||||
|
215.738,150.321 199.788,185.978 231.676,185.978 231.676,185.969 272.071,95.7 275.634,87.737 285.089,66.592 288.355,59.293
|
||||||
|
"/>
|
||||||
|
</g>
|
||||||
|
<polygon fill="#019733" points="180.483,59.198 183.329,66.556 180.471,66.556 "/>
|
||||||
|
<polygon fill="#019733" points="180.483,59.198 183.329,66.556 180.471,66.556 "/>
|
||||||
|
<g>
|
||||||
|
<polygon fill="#019733" points="290.713,66.592 285.054,66.592 288.32,59.293 "/>
|
||||||
|
<polygon fill="#019733" points="308.417,120.554 283.562,95.7 300.261,95.7 "/>
|
||||||
|
<polygon opacity="0.6" fill="#019733" points="308.417,120.554 283.562,95.7 300.261,95.7 "/>
|
||||||
|
<polygon fill="#019733" points="290.713,66.592 285.054,66.592 288.32,59.293 "/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path fill="#666666" d="M358.849,130.077v23.827h28.81V77.887h16.547v91.732h-62.987v-39.542H358.849z"/>
|
||||||
|
<path fill="#666666" d="M434.61,93.602v22.677h45.356v14.949H434.61v22.677h45.356v15.715h-62.987V77.887h62.987v15.715H434.61z"
|
||||||
|
/>
|
||||||
|
<path fill="#666666" d="M492.744,169.619V77.887h56.342l6.643,8.05v75.634l-6.579,8.049H492.744z M539.184,93.602h-28.811v60.303
|
||||||
|
h28.811V93.602z"/>
|
||||||
|
<path fill="#666666" d="M586.136,169.619h-17.632V77.887h17.632V169.619z"/>
|
||||||
|
<path fill="#666666" d="M598.913,116.278h33.281v14.949h-33.281V116.278z"/>
|
||||||
|
<path fill="#666666" d="M691.412,77.887h16.544l-19.995,91.732h-21.462l-21.527-91.732h17.63l13.798,70.588L691.412,77.887z"/>
|
||||||
|
<path fill="#666666" d="M738.364,169.619h-17.631V77.887h17.631V169.619z"/>
|
||||||
|
<path fill="#666666" d="M768.77,169.619h-17.632V77.887h17.632l17.886,50.273l18.59-50.273h16.545v91.732h-16.545v-38.392
|
||||||
|
l-12.84,38.392h-10.35l-13.286-38.392V169.619z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 9.8 KiB |
@@ -1,6 +1,4 @@
|
|||||||
let b:did_ftplugin = 1
|
if !jedi#init_python()
|
||||||
|
|
||||||
if !has('python') && !has('python3')
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
@@ -8,45 +6,57 @@ endif
|
|||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
|
|
||||||
if g:jedi#auto_initialization
|
if g:jedi#auto_initialization
|
||||||
setlocal omnifunc=jedi#complete
|
" goto / get_definition / usages
|
||||||
|
if len(g:jedi#goto_command)
|
||||||
" map ctrl+space for autocompletion
|
execute 'nnoremap <buffer> '.g:jedi#goto_command.' :call jedi#goto()<CR>'
|
||||||
if g:jedi#autocompletion_command == "<C-Space>"
|
endif
|
||||||
" in terminals, <C-Space> sometimes equals <Nul>
|
if len(g:jedi#goto_assignments_command)
|
||||||
inoremap <buffer><Nul> <C-X><C-O>
|
execute 'nnoremap <buffer> '.g:jedi#goto_assignments_command.' :call jedi#goto_assignments()<CR>'
|
||||||
|
endif
|
||||||
|
if len(g:jedi#goto_definitions_command)
|
||||||
|
execute 'nnoremap <buffer> '.g:jedi#goto_definitions_command.' :call jedi#goto_definitions()<CR>'
|
||||||
|
endif
|
||||||
|
if len(g:jedi#goto_stubs_command)
|
||||||
|
execute 'nnoremap <buffer> '.g:jedi#goto_stubs_command.' :call jedi#goto_stubs()<CR>'
|
||||||
|
endif
|
||||||
|
if len(g:jedi#usages_command)
|
||||||
|
execute 'nnoremap <buffer> '.g:jedi#usages_command.' :call jedi#usages()<CR>'
|
||||||
endif
|
endif
|
||||||
execute "inoremap <buffer>".g:jedi#autocompletion_command." <C-X><C-O>"
|
|
||||||
|
|
||||||
" goto / get_definition / related_names
|
|
||||||
execute "noremap <buffer>".g:jedi#goto_command." :call jedi#goto()<CR>"
|
|
||||||
execute "noremap <buffer>".g:jedi#get_definition_command." :call jedi#get_definition()<CR>"
|
|
||||||
execute "noremap <buffer>".g:jedi#related_names_command." :call jedi#related_names()<CR>"
|
|
||||||
" rename
|
" rename
|
||||||
execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename()<CR>"
|
if len(g:jedi#rename_command)
|
||||||
" pydoc
|
execute 'nnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename()<CR>'
|
||||||
execute "nnoremap <silent> <buffer>".g:jedi#pydoc." :call jedi#show_pydoc()<CR>"
|
execute 'vnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename_visual()<CR>'
|
||||||
|
endif
|
||||||
if g:jedi#show_function_definition == 1 && has('conceal')
|
if len(g:jedi#rename_command_keep_name)
|
||||||
call jedi#configure_function_definition()
|
execute 'nnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_keep_name()<CR>'
|
||||||
|
execute 'vnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_visual_keep_name()<CR>'
|
||||||
|
endif
|
||||||
|
" documentation/pydoc
|
||||||
|
if len(g:jedi#documentation_command)
|
||||||
|
execute 'nnoremap <silent> <buffer>'.g:jedi#documentation_command.' :call jedi#show_documentation()<CR>'
|
||||||
endif
|
endif
|
||||||
end
|
|
||||||
|
|
||||||
if g:jedi#auto_vim_configuration
|
if g:jedi#show_call_signatures > 0
|
||||||
setlocal completeopt=menuone,longest,preview
|
call jedi#configure_call_signatures()
|
||||||
if len(mapcheck('<C-c>', 'i')) == 0
|
endif
|
||||||
inoremap <C-c> <ESC>
|
|
||||||
|
if g:jedi#completions_enabled == 1
|
||||||
|
inoremap <silent> <buffer> . .<C-R>=jedi#complete_string(1)<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:jedi#smart_auto_mappings == 1
|
||||||
|
inoremap <silent> <buffer> <space> <C-R>=jedi#smart_auto_mappings()<CR>
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if g:jedi#popup_on_dot
|
if g:jedi#auto_close_doc && (&g:completeopt =~# '\<preview\>' && &g:completeopt !~# '\<popup\>')
|
||||||
if stridx(&completeopt, 'longest') > -1
|
" close preview if its still open after insert
|
||||||
inoremap <buffer> . .<C-R>=jedi#do_popup_on_dot() ? "\<lt>C-X>\<lt>C-O>" : ""<CR>
|
augroup jedi_preview
|
||||||
else
|
if v:version > 704
|
||||||
inoremap <buffer> . .<C-R>=jedi#do_popup_on_dot() ? "\<lt>C-X>\<lt>C-O>\<lt>C-P>" : ""<CR>
|
autocmd CompleteDone <buffer> pclose
|
||||||
end
|
else
|
||||||
end
|
autocmd InsertLeave <buffer> if pumvisible() == 0|pclose|endif
|
||||||
|
autocmd CursorMovedI <buffer> if pumvisible() == 0|pclose|endif
|
||||||
if g:jedi#auto_close_doc
|
endif
|
||||||
" close preview if its still open after insert
|
augroup END
|
||||||
autocmd InsertLeave <buffer> if pumvisible() == 0|pclose|endif
|
endif
|
||||||
end
|
endif
|
||||||
|
|||||||
1
jedi
1
jedi
Submodule jedi deleted from 89bd32e0d7
116
plugin/jedi.vim
116
plugin/jedi.vim
@@ -1,60 +1,82 @@
|
|||||||
"py_fuzzycomplete.vim - Omni Completion for python in vim
|
"jedi-vim - Omni Completion for python in vim
|
||||||
" Maintainer: David Halter <davidhalter88@gmail.com>
|
" Maintainer: David Halter <davidhalter88@gmail.com>
|
||||||
" Version: 0.1
|
|
||||||
"
|
"
|
||||||
" This part of the software is just the vim interface. The main source code
|
" This part of the software is just the vim interface. The really big deal is
|
||||||
" lies in the python files around it.
|
" the Jedi Python library.
|
||||||
|
|
||||||
if !has('python') && !has('python3')
|
if get(g:, 'jedi#auto_vim_configuration', 1)
|
||||||
if !exists("g:jedi#squelch_py_warning")
|
" jedi-vim doesn't work in compatible mode (vim script syntax problems)
|
||||||
echomsg "Error: Required vim compiled with +python"
|
if &compatible
|
||||||
|
" vint: -ProhibitSetNoCompatible
|
||||||
|
set nocompatible
|
||||||
|
" vint: +ProhibitSetNoCompatible
|
||||||
endif
|
endif
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" load plugin only once
|
" jedi-vim really needs, otherwise jedi-vim cannot start.
|
||||||
if exists("g:loaded_jedi") || &cp
|
filetype plugin on
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_jedi = 1
|
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
augroup jedi_pyi
|
||||||
" defaults for jedi-vim
|
au!
|
||||||
" ------------------------------------------------------------------------
|
autocmd BufNewFile,BufRead *.pyi set filetype=python
|
||||||
let s:settings = {
|
augroup END
|
||||||
\ 'use_tabs_not_buffers': 1,
|
|
||||||
\ 'auto_initialization': 1,
|
|
||||||
\ 'auto_vim_configuration': 1,
|
|
||||||
\ 'goto_command': "'<leader>g'",
|
|
||||||
\ 'autocompletion_command': "'<C-Space>'",
|
|
||||||
\ 'get_definition_command': "'<leader>d'",
|
|
||||||
\ 'related_names_command': "'<leader>n'",
|
|
||||||
\ 'rename_command': "'<leader>r'",
|
|
||||||
\ 'popup_on_dot': 1,
|
|
||||||
\ 'pydoc': "'K'",
|
|
||||||
\ 'show_function_definition': 1,
|
|
||||||
\ 'function_definition_escape': "'≡'",
|
|
||||||
\ 'auto_close_doc': 1
|
|
||||||
\ }
|
|
||||||
|
|
||||||
for [key, val] in items(s:settings)
|
" Change completeopt, but only if it was not set already.
|
||||||
if !exists('g:jedi#'.key)
|
" This gets done on VimEnter, since otherwise Vim fails to restore the
|
||||||
exe 'let g:jedi#'.key.' = '.val
|
" screen. Neovim is not affected, this is likely caused by using
|
||||||
|
" :redir/execute() before the (alternate) terminal is configured.
|
||||||
|
function! s:setup_completeopt()
|
||||||
|
if exists('*execute')
|
||||||
|
let completeopt = execute('silent verb set completeopt?')
|
||||||
|
else
|
||||||
|
redir => completeopt
|
||||||
|
silent verb set completeopt?
|
||||||
|
redir END
|
||||||
|
endif
|
||||||
|
if len(split(completeopt, '\n')) == 1
|
||||||
|
set completeopt=menuone,longest
|
||||||
|
if v:version > 801 || (v:version == 801 && has('patch-8.1.1882'))
|
||||||
|
set completeopt+=popup
|
||||||
|
else
|
||||||
|
set completeopt+=preview
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
if has('nvim')
|
||||||
|
call s:setup_completeopt()
|
||||||
|
else
|
||||||
|
augroup jedi_startup
|
||||||
|
au!
|
||||||
|
autocmd VimEnter * call s:setup_completeopt()
|
||||||
|
augroup END
|
||||||
endif
|
endif
|
||||||
endfor
|
|
||||||
|
|
||||||
|
if len(mapcheck('<C-c>', 'i')) == 0
|
||||||
if g:jedi#auto_initialization
|
inoremap <C-c> <ESC>
|
||||||
" this is only here because in some cases the VIM library adds their
|
endif
|
||||||
" autocompletion as a default, which may cause problems, depending on the
|
|
||||||
" order of invocation.
|
|
||||||
autocmd FileType Python setlocal omnifunc=jedi#complete switchbuf=useopen " needed for pydoc
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('python')
|
" Pyimport command
|
||||||
command! -nargs=1 Python python <args>
|
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
|
||||||
else
|
|
||||||
command! -nargs=1 Python python3 <args>
|
command! -nargs=? -complete=file JediChooseEnvironment :call jedi#choose_environment(<q-args>)
|
||||||
end
|
command! -nargs=? -complete=file JediLoadProject :call jedi#load_project(<q-args>)
|
||||||
|
|
||||||
|
|
||||||
|
function! s:jedi_debug_info()
|
||||||
|
" Ensure the autoload file has been loaded (and ignore any errors, which
|
||||||
|
" will be displayed with the debug info).
|
||||||
|
let unset = {}
|
||||||
|
let saved_squelch_py_warning = get(g:, 'jedi#squelch_py_warning', unset)
|
||||||
|
let g:jedi#squelch_py_warning = 1
|
||||||
|
call jedi#init_python()
|
||||||
|
if saved_squelch_py_warning is unset
|
||||||
|
unlet g:jedi#squelch_py_warning
|
||||||
|
else
|
||||||
|
let g:jedi#squelch_py_warning = saved_squelch_py_warning
|
||||||
|
endif
|
||||||
|
call jedi#debug_info()
|
||||||
|
endfunction
|
||||||
|
command! -nargs=0 -bar JediDebugInfo call s:jedi_debug_info()
|
||||||
|
command! -nargs=0 -bang JediClearCache call jedi#clear_cache(<bang>0)
|
||||||
|
|
||||||
" vim: set et ts=4:
|
" vim: set et ts=4:
|
||||||
|
|||||||
@@ -1,336 +0,0 @@
|
|||||||
"""
|
|
||||||
The Python parts of the Jedi library for VIM. It is mostly about communicating
|
|
||||||
with VIM.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import traceback # for exception output
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
|
|
||||||
import vim
|
|
||||||
import jedi
|
|
||||||
import jedi.keywords
|
|
||||||
from jedi._compatibility import unicode
|
|
||||||
|
|
||||||
temp_rename = None # used for jedi#rename
|
|
||||||
|
|
||||||
|
|
||||||
class PythonToVimStr(unicode):
|
|
||||||
""" Vim has a different string implementation of single quotes """
|
|
||||||
__slots__ = []
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
# this is totally stupid and makes no sense but vim/python unicode
|
|
||||||
# support is pretty bad. don't ask how I came up with this... It just
|
|
||||||
# works...
|
|
||||||
# It seems to be related to that bug: http://bugs.python.org/issue5876
|
|
||||||
s = self.encode('UTF-8')
|
|
||||||
return '"%s"' % s.replace('\\', '\\\\').replace('"', r'\"')
|
|
||||||
|
|
||||||
|
|
||||||
def echo_highlight(msg):
|
|
||||||
vim.command('echohl WarningMsg | echo "%s" | echohl None' % msg)
|
|
||||||
|
|
||||||
|
|
||||||
def get_script(source=None, column=None):
|
|
||||||
jedi.settings.additional_dynamic_modules = [b.name for b in vim.buffers
|
|
||||||
if b.name is not None and b.name.endswith('.py')]
|
|
||||||
if source is None:
|
|
||||||
source = '\n'.join(vim.current.buffer)
|
|
||||||
row = vim.current.window.cursor[0]
|
|
||||||
if column is None:
|
|
||||||
column = vim.current.window.cursor[1]
|
|
||||||
buf_path = vim.current.buffer.name
|
|
||||||
encoding = vim.eval('&encoding')
|
|
||||||
return jedi.Script(source, row, column, buf_path, encoding)
|
|
||||||
|
|
||||||
|
|
||||||
def complete():
|
|
||||||
row, column = vim.current.window.cursor
|
|
||||||
clear_func_def()
|
|
||||||
if vim.eval('a:findstart') == '1':
|
|
||||||
count = 0
|
|
||||||
for char in reversed(vim.current.line[:column]):
|
|
||||||
if not re.match('[\w\d]', char):
|
|
||||||
break
|
|
||||||
count += 1
|
|
||||||
vim.command('return %i' % (column - count))
|
|
||||||
else:
|
|
||||||
base = vim.eval('a:base')
|
|
||||||
source = ''
|
|
||||||
for i, line in enumerate(vim.current.buffer):
|
|
||||||
# enter this path again, otherwise source would be incomplete
|
|
||||||
if i == row - 1:
|
|
||||||
source += line[:column] + base + line[column:]
|
|
||||||
else:
|
|
||||||
source += line
|
|
||||||
source += '\n'
|
|
||||||
# here again hacks, because jedi has a different interface than vim
|
|
||||||
column += len(base)
|
|
||||||
try:
|
|
||||||
script = get_script(source=source, column=column)
|
|
||||||
completions = script.complete()
|
|
||||||
call_def = script.get_in_function_call()
|
|
||||||
|
|
||||||
out = []
|
|
||||||
for c in completions:
|
|
||||||
d = dict(word=PythonToVimStr(c.word[:len(base)] + c.complete),
|
|
||||||
abbr=PythonToVimStr(c.word),
|
|
||||||
# stuff directly behind the completion
|
|
||||||
menu=PythonToVimStr(c.description),
|
|
||||||
info=PythonToVimStr(c.doc), # docstr
|
|
||||||
icase=1, # case insensitive
|
|
||||||
dup=1 # allow duplicates (maybe later remove this)
|
|
||||||
)
|
|
||||||
out.append(d)
|
|
||||||
|
|
||||||
strout = str(out)
|
|
||||||
except Exception:
|
|
||||||
# print to stdout, will be in :messages
|
|
||||||
print(traceback.format_exc())
|
|
||||||
strout = ''
|
|
||||||
completions = []
|
|
||||||
call_def = None
|
|
||||||
|
|
||||||
#print 'end', strout
|
|
||||||
show_func_def(call_def, len(completions))
|
|
||||||
vim.command('return ' + strout)
|
|
||||||
|
|
||||||
|
|
||||||
def goto(is_definition=False, is_related_name=False, no_output=False):
|
|
||||||
definitions = []
|
|
||||||
script = get_script()
|
|
||||||
try:
|
|
||||||
if is_related_name:
|
|
||||||
definitions = script.related_names()
|
|
||||||
elif is_definition:
|
|
||||||
definitions = script.get_definition()
|
|
||||||
else:
|
|
||||||
definitions = script.goto()
|
|
||||||
except jedi.NotFoundError:
|
|
||||||
echo_highlight(
|
|
||||||
"Cannot follow nothing. Put your cursor on a valid name.")
|
|
||||||
except Exception:
|
|
||||||
# print to stdout, will be in :messages
|
|
||||||
echo_highlight("Some different eror, this shouldn't happen.")
|
|
||||||
print(traceback.format_exc())
|
|
||||||
else:
|
|
||||||
if no_output:
|
|
||||||
return definitions
|
|
||||||
if not definitions:
|
|
||||||
echo_highlight("Couldn't find any definitions for this.")
|
|
||||||
elif len(definitions) == 1 and not is_related_name:
|
|
||||||
# just add some mark to add the current position to the jumplist.
|
|
||||||
# this is ugly, because it overrides the mark for '`', so if anyone
|
|
||||||
# has a better idea, let me know.
|
|
||||||
vim.command('normal! m`')
|
|
||||||
|
|
||||||
d = list(definitions)[0]
|
|
||||||
if d.in_builtin_module():
|
|
||||||
if isinstance(d.definition, jedi.keywords.Keyword):
|
|
||||||
echo_highlight(
|
|
||||||
"Cannot get the definition of Python keywords.")
|
|
||||||
else:
|
|
||||||
echo_highlight("Builtin modules cannot be displayed.")
|
|
||||||
else:
|
|
||||||
if d.module_path != vim.current.buffer.name:
|
|
||||||
vim.eval('jedi#new_buffer(%s)' % \
|
|
||||||
repr(PythonToVimStr(d.module_path)))
|
|
||||||
vim.current.window.cursor = d.line_nr, d.column
|
|
||||||
vim.command('normal! zt') # cursor at top of screen
|
|
||||||
else:
|
|
||||||
# multiple solutions
|
|
||||||
lst = []
|
|
||||||
for d in definitions:
|
|
||||||
if d.in_builtin_module():
|
|
||||||
lst.append(dict(text=
|
|
||||||
PythonToVimStr('Builtin ' + d.description)))
|
|
||||||
else:
|
|
||||||
lst.append(dict(filename=PythonToVimStr(d.module_path),
|
|
||||||
lnum=d.line_nr, col=d.column + 1,
|
|
||||||
text=PythonToVimStr(d.description)))
|
|
||||||
vim.eval('setqflist(%s)' % repr(lst))
|
|
||||||
vim.eval('<sid>add_goto_window()')
|
|
||||||
return definitions
|
|
||||||
|
|
||||||
|
|
||||||
def show_pydoc():
|
|
||||||
script = get_script()
|
|
||||||
try:
|
|
||||||
definitions = script.get_definition()
|
|
||||||
except jedi.NotFoundError:
|
|
||||||
definitions = []
|
|
||||||
except Exception:
|
|
||||||
# print to stdout, will be in :messages
|
|
||||||
definitions = []
|
|
||||||
print("Exception, this shouldn't happen.")
|
|
||||||
print(traceback.format_exc())
|
|
||||||
|
|
||||||
if not definitions:
|
|
||||||
vim.command('return')
|
|
||||||
else:
|
|
||||||
docs = ['Docstring for %s\n%s\n%s' % (d.desc_with_module, '='*40, d.doc) if d.doc
|
|
||||||
else '|No Docstring for %s|' % d for d in definitions]
|
|
||||||
text = ('\n' + '-' * 79 + '\n').join(docs)
|
|
||||||
vim.command('let l:doc = %s' % repr(PythonToVimStr(text)))
|
|
||||||
vim.command('let l:doc_lines = %s' % len(text.split('\n')))
|
|
||||||
|
|
||||||
|
|
||||||
def clear_func_def():
|
|
||||||
cursor = vim.current.window.cursor
|
|
||||||
e = vim.eval('g:jedi#function_definition_escape')
|
|
||||||
regex = r'%sjedi=([0-9]+), ([^%s]*)%s.*%sjedi%s'.replace('%s', e)
|
|
||||||
for i, line in enumerate(vim.current.buffer):
|
|
||||||
match = re.search(r'%s' % regex, line)
|
|
||||||
if match is not None:
|
|
||||||
vim_regex = r'\v' + regex.replace('=', r'\=') + '.{%s}' % \
|
|
||||||
int(match.group(1))
|
|
||||||
vim.command(r'try | %s,%ss/%s/\2/g | catch | endtry' \
|
|
||||||
% (i + 1, i + 1, vim_regex))
|
|
||||||
vim.eval('histdel("search", -1)')
|
|
||||||
vim.command('let @/ = histget("search", -1)')
|
|
||||||
vim.current.window.cursor = cursor
|
|
||||||
|
|
||||||
|
|
||||||
def show_func_def(call_def=None, completion_lines=0):
|
|
||||||
if vim.eval("has('conceal') && g:jedi#show_function_definition") == '0':
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
if call_def == None:
|
|
||||||
call_def = get_script().get_in_function_call()
|
|
||||||
clear_func_def()
|
|
||||||
|
|
||||||
if call_def is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
row, column = call_def.bracket_start
|
|
||||||
if column < 2 or row == 0:
|
|
||||||
return # edge cases, just ignore
|
|
||||||
|
|
||||||
# TODO check if completion menu is above or below
|
|
||||||
row_to_replace = row - 1
|
|
||||||
line = vim.eval("getline(%s)" % row_to_replace)
|
|
||||||
|
|
||||||
insert_column = column - 2 # because it has stuff at the beginning
|
|
||||||
|
|
||||||
params = [p.get_code().replace('\n', '') for p in call_def.params]
|
|
||||||
try:
|
|
||||||
params[call_def.index] = '*%s*' % params[call_def.index]
|
|
||||||
except (IndexError, TypeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
# This stuff is reaaaaally a hack! I cannot stress enough, that this is
|
|
||||||
# a stupid solution. But there is really no other yet. There is no
|
|
||||||
# possibility in VIM to draw on the screen, but there will be one (see
|
|
||||||
# :help todo Patch to access screen under Python. (Marko Mahni, 2010
|
|
||||||
# Jul 18))
|
|
||||||
text = " (%s) " % ', '.join(params)
|
|
||||||
text = ' ' * (insert_column - len(line)) + text
|
|
||||||
end_column = insert_column + len(text) - 2 # -2 due to bold symbols
|
|
||||||
|
|
||||||
# Need to decode it with utf8, because vim returns always a python 2
|
|
||||||
# string even if it is unicode.
|
|
||||||
e = vim.eval('g:jedi#function_definition_escape').decode('UTF-8')
|
|
||||||
# replace line before with cursor
|
|
||||||
regex = "xjedi=%sx%sxjedix".replace('x', e)
|
|
||||||
|
|
||||||
prefix, replace = line[:insert_column], line[insert_column:end_column]
|
|
||||||
|
|
||||||
# Check the replace stuff for strings, to append them
|
|
||||||
# (don't want to break the syntax)
|
|
||||||
regex_quotes = r'''\\*["']+'''
|
|
||||||
# `add` are all the quotation marks.
|
|
||||||
# join them with a space to avoid producing '''
|
|
||||||
add = ' '.join(re.findall(regex_quotes, replace))
|
|
||||||
# search backwards
|
|
||||||
if add and replace[0] in ['"', "'"]:
|
|
||||||
a = re.search(regex_quotes + '$', prefix)
|
|
||||||
add = ('' if a is None else a.group(0)) + add
|
|
||||||
|
|
||||||
tup = '%s, %s' % (len(add), replace)
|
|
||||||
repl = prefix + (regex % (tup, text)) + add + line[end_column:]
|
|
||||||
|
|
||||||
vim.eval('setline(%s, %s)' % \
|
|
||||||
(row_to_replace, repr(PythonToVimStr(repl))))
|
|
||||||
except Exception:
|
|
||||||
print(traceback.format_exc())
|
|
||||||
|
|
||||||
|
|
||||||
def rename():
|
|
||||||
global temp_rename
|
|
||||||
if not int(vim.eval('a:0')):
|
|
||||||
temp_rename = goto(is_related_name=True, no_output=True)
|
|
||||||
_rename_cursor = vim.current.window.cursor
|
|
||||||
|
|
||||||
vim.command('normal A ') # otherwise startinsert doesn't work well
|
|
||||||
vim.current.window.cursor = _rename_cursor
|
|
||||||
|
|
||||||
vim.command('augroup jedi_rename')
|
|
||||||
vim.command('autocmd InsertLeave <buffer> call jedi#rename(1)')
|
|
||||||
vim.command('augroup END')
|
|
||||||
|
|
||||||
vim.command('normal! diw')
|
|
||||||
vim.command(':startinsert')
|
|
||||||
else:
|
|
||||||
cursor = vim.current.window.cursor
|
|
||||||
window_path = vim.current.buffer.name
|
|
||||||
# reset autocommand
|
|
||||||
vim.command('autocmd! jedi_rename InsertLeave')
|
|
||||||
|
|
||||||
replace = vim.eval("expand('<cword>')")
|
|
||||||
vim.command('normal! u') # undo new word
|
|
||||||
vim.command('normal! u') # 2u didn't work...
|
|
||||||
|
|
||||||
if replace is None:
|
|
||||||
echo_highlight('No rename possible, if no name is given.')
|
|
||||||
else:
|
|
||||||
# sort the whole thing reverse (positions at the end of the line
|
|
||||||
# must be first, because they move the stuff before the position).
|
|
||||||
temp_rename = sorted(temp_rename, reverse=True,
|
|
||||||
key=lambda x: (x.module_path, x.start_pos))
|
|
||||||
for r in temp_rename:
|
|
||||||
if r.in_builtin_module():
|
|
||||||
continue
|
|
||||||
if vim.current.buffer.name != r.module_path:
|
|
||||||
vim.eval("jedi#new_buffer('%s')" % r.module_path)
|
|
||||||
|
|
||||||
vim.current.window.cursor = r.start_pos
|
|
||||||
vim.command('normal! cw%s' % replace)
|
|
||||||
|
|
||||||
vim.current.window.cursor = cursor
|
|
||||||
vim.eval("jedi#new_buffer('%s')" % window_path)
|
|
||||||
echo_highlight('Jedi did %s renames!' % len(temp_rename))
|
|
||||||
# reset rename variables
|
|
||||||
temp_rename = None
|
|
||||||
|
|
||||||
|
|
||||||
def tabnew(path):
|
|
||||||
path = os.path.abspath(path)
|
|
||||||
for tab_nr in range(int(vim.eval("tabpagenr('$')"))):
|
|
||||||
for buf_nr in vim.eval("tabpagebuflist(%i + 1)" % tab_nr):
|
|
||||||
buf_nr = int(buf_nr) - 1
|
|
||||||
try:
|
|
||||||
buf_path = vim.buffers[buf_nr].name
|
|
||||||
except IndexError:
|
|
||||||
# Just do good old asking for forgiveness.
|
|
||||||
# don't know why this happens :-)
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if buf_path == path:
|
|
||||||
# tab exists, just switch to that tab
|
|
||||||
vim.command('tabfirst | tabnext %i' % (tab_nr + 1))
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
# tab doesn't exist, add a new one.
|
|
||||||
vim.command('tabnew %s' % path)
|
|
||||||
|
|
||||||
|
|
||||||
def escape_file_path(path):
|
|
||||||
return path.replace(' ', r'\ ')
|
|
||||||
|
|
||||||
|
|
||||||
def print_to_stdout(level, str_out):
|
|
||||||
print(str_out)
|
|
||||||
1
pythonx/jedi
Submodule
1
pythonx/jedi
Submodule
Submodule pythonx/jedi added at 51f4a99a1e
1230
pythonx/jedi_vim.py
Normal file
1230
pythonx/jedi_vim.py
Normal file
File diff suppressed because it is too large
Load Diff
96
pythonx/jedi_vim_debug.py
Normal file
96
pythonx/jedi_vim_debug.py
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
"""Used in jedi-vim's jedi#debug_info()"""
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import vim
|
||||||
|
from jedi_vim import PythonToVimStr, jedi
|
||||||
|
|
||||||
|
|
||||||
|
def echo(msg):
|
||||||
|
vim.command('echo %r' % PythonToVimStr(msg))
|
||||||
|
|
||||||
|
|
||||||
|
def echo_error(msg):
|
||||||
|
vim.command('echohl ErrorMsg')
|
||||||
|
echo(msg)
|
||||||
|
vim.command('echohl None')
|
||||||
|
|
||||||
|
|
||||||
|
def format_exc_info(exc_info=None, tb_indent=2):
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
if exc_info is None:
|
||||||
|
exc_info = sys.exc_info()
|
||||||
|
|
||||||
|
exc_msg = traceback.format_exception_only(exc_info[0], exc_info[1])
|
||||||
|
lines = ''.join(exc_msg).rstrip('\n').split('\n')
|
||||||
|
|
||||||
|
lines.append('Traceback (most recent call last):')
|
||||||
|
tb = traceback.format_tb(exc_info[2])
|
||||||
|
lines.extend(''.join(tb).rstrip('\n').split('\n'))
|
||||||
|
|
||||||
|
indent = ' ' * tb_indent
|
||||||
|
return '{0}'.format(('\n' + indent).join(lines))
|
||||||
|
|
||||||
|
|
||||||
|
def get_known_environments():
|
||||||
|
"""Get known Jedi environments."""
|
||||||
|
envs = list(jedi.find_virtualenvs())
|
||||||
|
envs.extend(jedi.find_system_environments())
|
||||||
|
return envs
|
||||||
|
|
||||||
|
|
||||||
|
def display_debug_info():
|
||||||
|
echo(' - global sys.executable: `{0}`'.format(sys.executable))
|
||||||
|
echo(' - global sys.version: `{0}`'.format(
|
||||||
|
', '.join([x.strip()
|
||||||
|
for x in sys.version.split('\n')])))
|
||||||
|
echo(' - global site module: `{0}`'.format(__import__('site').__file__))
|
||||||
|
|
||||||
|
try:
|
||||||
|
import jedi_vim
|
||||||
|
except Exception:
|
||||||
|
echo_error('ERROR: could not import jedi_vim: {0}'.format(
|
||||||
|
format_exc_info()))
|
||||||
|
return
|
||||||
|
|
||||||
|
if jedi_vim.jedi is None:
|
||||||
|
if hasattr(jedi_vim, 'jedi_import_error'):
|
||||||
|
error_msg = format_exc_info(jedi_vim.jedi_import_error)
|
||||||
|
else:
|
||||||
|
error_msg = 'unknown error'
|
||||||
|
echo_error('ERROR: could not import the "jedi" Python module: {0}'.format(
|
||||||
|
error_msg))
|
||||||
|
else:
|
||||||
|
echo('\n##### Jedi\n\n - path: `{0}`'.format(jedi_vim.jedi.__file__))
|
||||||
|
echo(' - version: {0}'.format(jedi_vim.jedi.__version__))
|
||||||
|
|
||||||
|
try:
|
||||||
|
project = jedi_vim.get_project()
|
||||||
|
environment = project.get_environment()
|
||||||
|
except AttributeError:
|
||||||
|
script_evaluator = jedi_vim.jedi.Script('')._evaluator
|
||||||
|
try:
|
||||||
|
sys_path = script_evaluator.project.sys_path
|
||||||
|
except AttributeError:
|
||||||
|
sys_path = script_evaluator.sys_path
|
||||||
|
else:
|
||||||
|
echo('\n##### Jedi environment: {0}\n\n'.format(environment))
|
||||||
|
echo(' - executable: {0}'.format(environment.executable))
|
||||||
|
try:
|
||||||
|
sys_path = environment.get_sys_path()
|
||||||
|
except Exception:
|
||||||
|
echo_error('ERROR: failed to get sys path from environment: {0}'.format(
|
||||||
|
format_exc_info()))
|
||||||
|
return
|
||||||
|
|
||||||
|
echo(' - sys_path:')
|
||||||
|
for p in sys_path:
|
||||||
|
echo(' - `{0}`'.format(p))
|
||||||
|
|
||||||
|
if environment:
|
||||||
|
echo('\n##### Known environments\n\n')
|
||||||
|
for environment in get_known_environments():
|
||||||
|
echo(' - {0} ({1})\n'.format(
|
||||||
|
environment,
|
||||||
|
environment.executable,
|
||||||
|
))
|
||||||
1
pythonx/parso
Submodule
1
pythonx/parso
Submodule
Submodule pythonx/parso added at ee5edaf22f
5
setup.cfg
Normal file
5
setup.cfg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[tool:pytest]
|
||||||
|
testpaths = test
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 100
|
||||||
11
test/_utils.vim
Normal file
11
test/_utils.vim
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
function! CurrentBufferIsModule(module_name)
|
||||||
|
return EndsWith(bufname('%'), a:module_name.'.py')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function EndsWith(string, end)
|
||||||
|
let l:should = len(a:string) - strlen(a:end)
|
||||||
|
return l:should == stridx(a:string, a:end, should)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
65
test/test_integration.py
Normal file
65
test/test_integration.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
"""Runs tests from ./vspec in vim-vspec."""
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
try:
|
||||||
|
from urllib.request import urlretrieve
|
||||||
|
except ImportError:
|
||||||
|
from urllib import urlretrieve
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
vspec_version = '1.9.0'
|
||||||
|
|
||||||
|
VSPEC_URL = 'https://github.com/kana/vim-vspec/archive/%s.zip' % vspec_version
|
||||||
|
root = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
CACHE_FOLDER = os.path.join(root, 'build')
|
||||||
|
VSPEC_FOLDER = os.path.join(CACHE_FOLDER, 'vim-vspec-%s' % vspec_version)
|
||||||
|
VSPEC_RUNNER = os.path.join(VSPEC_FOLDER, 'bin/vspec')
|
||||||
|
TEST_DIR = os.path.join(root, 'test', 'vspec')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session')
|
||||||
|
def install_vspec():
|
||||||
|
if not os.path.isdir(CACHE_FOLDER):
|
||||||
|
os.mkdir(CACHE_FOLDER)
|
||||||
|
|
||||||
|
if not os.path.exists(VSPEC_FOLDER):
|
||||||
|
name, hdrs = urlretrieve(VSPEC_URL)
|
||||||
|
z = zipfile.ZipFile(name)
|
||||||
|
for n in z.namelist():
|
||||||
|
dest = os.path.join(CACHE_FOLDER, n)
|
||||||
|
destdir = os.path.dirname(dest)
|
||||||
|
if not os.path.isdir(destdir):
|
||||||
|
os.makedirs(destdir)
|
||||||
|
data = z.read(n)
|
||||||
|
if not os.path.isdir(dest):
|
||||||
|
with open(dest, 'wb') as f:
|
||||||
|
f.write(data)
|
||||||
|
z.close()
|
||||||
|
os.chmod(VSPEC_RUNNER, 0o777)
|
||||||
|
|
||||||
|
|
||||||
|
def get_vspec_tests():
|
||||||
|
for f in os.listdir(TEST_DIR):
|
||||||
|
yield os.path.relpath(os.path.join(TEST_DIR, f))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('path', get_vspec_tests())
|
||||||
|
def test_integration(install_vspec, path):
|
||||||
|
output = subprocess.check_output(
|
||||||
|
[VSPEC_RUNNER, '.', VSPEC_FOLDER, os.path.relpath(path, root)],
|
||||||
|
cwd=root,
|
||||||
|
)
|
||||||
|
had_ok = False
|
||||||
|
for line in output.splitlines():
|
||||||
|
if (line.startswith(b'not ok') or
|
||||||
|
line.startswith(b'Error') or
|
||||||
|
line.startswith(b'Bail out!')):
|
||||||
|
pytest.fail(u"{0} failed:\n{1}".format(
|
||||||
|
path, output.decode('utf-8')), pytrace=False)
|
||||||
|
if not had_ok and line.startswith(b'ok'):
|
||||||
|
had_ok = True
|
||||||
|
if not had_ok:
|
||||||
|
pytest.fail(u"{0} failed: no 'ok' found:\n{1}".format(
|
||||||
|
path, output.decode('utf-8')), pytrace=False)
|
||||||
8
test/vimrc
Normal file
8
test/vimrc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
" Minimal vimrc to use jedi-vim.
|
||||||
|
"
|
||||||
|
" Not used anywhere yet, but allows for easy testing.
|
||||||
|
let script_dir = fnamemodify(expand('<sfile>'), ':h:h')
|
||||||
|
let &runtimepath = script_dir.','.&runtimepath.','.script_dir.'/after'
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
filetype plugin indent on
|
||||||
29
test/vspec/choose-venv.vim
Normal file
29
test/vspec/choose-venv.vim
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
source plugin/jedi.vim
|
||||||
|
source test/_utils.vim
|
||||||
|
|
||||||
|
describe 'simple:'
|
||||||
|
before
|
||||||
|
new
|
||||||
|
normal! ifoo
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
bd!
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'choose'
|
||||||
|
Expect g:jedi#environment_path == 'auto'
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
|
||||||
|
JediChooseEnvironment
|
||||||
|
" A Python executable needs to be a few letters
|
||||||
|
Expect len(getline('.')) > 5
|
||||||
|
Expect bufname('%') == 'Hit Enter to Choose an Environment'
|
||||||
|
|
||||||
|
execute "normal \<CR>"
|
||||||
|
Expect g:jedi#environment_path != 'auto'
|
||||||
|
bd " TODO why is this necessary? There seems to be a random buffer.
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
Expect getline('.') == 'foo'
|
||||||
|
end
|
||||||
|
end
|
||||||
131
test/vspec/completions.vim
Normal file
131
test/vspec/completions.vim
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
let g:jedi#completions_command = 'X'
|
||||||
|
source plugin/jedi.vim
|
||||||
|
|
||||||
|
describe 'completions'
|
||||||
|
before
|
||||||
|
new
|
||||||
|
set filetype=python
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
" default
|
||||||
|
let g:jedi#popup_select_first = 1
|
||||||
|
bd!
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'longest in completeopt'
|
||||||
|
" This gets set up with Vim only on VimEnter.
|
||||||
|
if has('nvim')
|
||||||
|
Expect stridx(&completeopt, 'longest') > -1
|
||||||
|
else
|
||||||
|
Expect stridx(&completeopt, 'longest') == -1
|
||||||
|
doautocmd VimEnter
|
||||||
|
Expect stridx(&completeopt, 'longest') > -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Do not use it for following tests.
|
||||||
|
set completeopt-=longest
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'no smart import by default'
|
||||||
|
exec "normal ifrom os "
|
||||||
|
Expect getline('.') == 'from os '
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'import'
|
||||||
|
" X is the completion command
|
||||||
|
normal oimporX
|
||||||
|
Expect getline('.') == 'import'
|
||||||
|
normal a subproX
|
||||||
|
Expect getline('.') == 'import subprocess'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'exception'
|
||||||
|
normal oIndentationErrX
|
||||||
|
Expect getline('.') == 'IndentationError'
|
||||||
|
|
||||||
|
" Do not remap keys (".") here, otherwise this triggers completion in
|
||||||
|
" Neovim already.
|
||||||
|
normal! a().filena
|
||||||
|
|
||||||
|
normal aX
|
||||||
|
Expect getline('.') == 'IndentationError().filename'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'multi complete'
|
||||||
|
" NOTE: nvim results in "importErr()" here with completeopt+=longest,
|
||||||
|
" but Vim is fine.
|
||||||
|
" This is due to `pumvisible()` in jedi#complete_opened being true
|
||||||
|
" with nvim still, but it is 0 with Vim, i.e. Vim appears to close
|
||||||
|
" the pum already (with the tests).
|
||||||
|
"
|
||||||
|
" This might be a misunderstanding though, since the test might not
|
||||||
|
" expect the "import" keyword to be offered for completion?!
|
||||||
|
normal oImpXErrX()
|
||||||
|
Expect getline('.') == 'ImportError()'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'cycling through entries popup_select_first=0'
|
||||||
|
set completeopt+=longest
|
||||||
|
let g:jedi#popup_select_first = 0
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
|
||||||
|
Expect getline('.') == 'raise ImportError'
|
||||||
|
set completeopt-=longest
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'cycling through entries popup_select_first=1'
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'cycling through entries popup_select_first=1 and longest'
|
||||||
|
set completeopt+=longest
|
||||||
|
execute "normal oraise impX"
|
||||||
|
Expect getline('.') == 'raise Import'
|
||||||
|
|
||||||
|
" With Neovim pumvisible() is 1 in jedi#complete_opened, which then
|
||||||
|
" triggers the <Down>. This is not the case with Vim.
|
||||||
|
if has('nvim')
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
|
|
||||||
|
execute "normal oraise impX\<C-n>\<C-n>"
|
||||||
|
Expect getline('.') == 'raise imp'
|
||||||
|
else
|
||||||
|
execute "normal oraise impX\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportError'
|
||||||
|
|
||||||
|
execute "normal oraise impX\<C-n>\<C-n>"
|
||||||
|
Expect getline('.') == 'raise ImportWarning'
|
||||||
|
endif
|
||||||
|
set completeopt-=longest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'smart completions'
|
||||||
|
before
|
||||||
|
new
|
||||||
|
let g:jedi#smart_auto_mappings = 1
|
||||||
|
set filetype=python
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
" default
|
||||||
|
let g:jedi#smart_auto_mappings = 0
|
||||||
|
bd!
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'smart import'
|
||||||
|
exec "normal ifrom os "
|
||||||
|
Expect getline('.') == 'from os import '
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'no smart import after space'
|
||||||
|
exec "normal! ifrom os "
|
||||||
|
exec "normal a "
|
||||||
|
Expect getline('.') == 'from os '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
20
test/vspec/completions_disabled.vim
Normal file
20
test/vspec/completions_disabled.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
let g:jedi#completions_command = 'X'
|
||||||
|
let g:jedi#completions_enabled = 0
|
||||||
|
source plugin/jedi.vim
|
||||||
|
|
||||||
|
describe 'completions_disabled'
|
||||||
|
before
|
||||||
|
set filetype=python
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'typing'
|
||||||
|
normal oraise ImportErrX
|
||||||
|
Expect getline('.') == 'raise ImportErrX'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
34
test/vspec/documentation.vim
Normal file
34
test/vspec/documentation.vim
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
source plugin/jedi.vim
|
||||||
|
|
||||||
|
describe 'documentation docstrings'
|
||||||
|
before
|
||||||
|
set filetype=python
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'simple'
|
||||||
|
Expect maparg('K') == ':call jedi#show_documentation()<CR>'
|
||||||
|
put = 'ImportError'
|
||||||
|
normal GK
|
||||||
|
Expect bufname('%') == "__doc__"
|
||||||
|
Expect &filetype == 'rst'
|
||||||
|
let header = getline(1, 2)
|
||||||
|
Expect header[0] == "Docstring for class builtins.ImportError"
|
||||||
|
Expect header[1] == "========================================"
|
||||||
|
let content = join(getline(3, '$'), "\n")
|
||||||
|
Expect stridx(content, "Import can't find module") > 0
|
||||||
|
normal K
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'no documentation'
|
||||||
|
put = 'x = 2'
|
||||||
|
normal o<ESC>GK
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
177
test/vspec/goto.vim
Normal file
177
test/vspec/goto.vim
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
let mapleader = '\'
|
||||||
|
source plugin/jedi.vim
|
||||||
|
source test/_utils.vim
|
||||||
|
|
||||||
|
describe 'goto simple:'
|
||||||
|
before
|
||||||
|
new
|
||||||
|
set filetype=python
|
||||||
|
put =[
|
||||||
|
\ 'def a(): pass',
|
||||||
|
\ 'b = a',
|
||||||
|
\ 'c = b',
|
||||||
|
\ ]
|
||||||
|
normal! ggdd
|
||||||
|
normal! G$
|
||||||
|
Expect line('.') == 3
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
bd!
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'goto definitions'
|
||||||
|
normal \d
|
||||||
|
Expect line('.') == 2
|
||||||
|
Expect col('.') == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'goto assignments'
|
||||||
|
normal \g
|
||||||
|
Expect line('.') == 2
|
||||||
|
Expect col('.') == 1
|
||||||
|
|
||||||
|
" cursor before `=` means that it stays there.
|
||||||
|
normal \g
|
||||||
|
Expect line('.') == 2
|
||||||
|
Expect col('.') == 1
|
||||||
|
|
||||||
|
" going to the last line changes it.
|
||||||
|
normal! $
|
||||||
|
normal \g
|
||||||
|
Expect line('.') == 1
|
||||||
|
Expect col('.') == 5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe 'goto with tabs:'
|
||||||
|
before
|
||||||
|
set filetype=python
|
||||||
|
let g:jedi#use_tabs_not_buffers = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'follow import'
|
||||||
|
put = ['import subprocess', 'subprocess']
|
||||||
|
normal G\g
|
||||||
|
Expect getline('.') == 'import subprocess'
|
||||||
|
Expect line('.') == 2
|
||||||
|
Expect col('.') == 8
|
||||||
|
|
||||||
|
normal G\d
|
||||||
|
Expect CurrentBufferIsModule('subprocess') == 1
|
||||||
|
Expect line('.') == 1
|
||||||
|
Expect col('.') == 1
|
||||||
|
Expect tabpagenr('$') == 2
|
||||||
|
Expect winnr('$') == 1
|
||||||
|
bwipe
|
||||||
|
|
||||||
|
Expect tabpagenr('$') == 1
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe 'goto with buffers'
|
||||||
|
before
|
||||||
|
set filetype=python
|
||||||
|
let g:jedi#use_tabs_not_buffers = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
set nohidden
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'no new tabs'
|
||||||
|
put = ['import os']
|
||||||
|
normal G$
|
||||||
|
call jedi#goto_assignments()
|
||||||
|
python3 jedi_vim.goto()
|
||||||
|
Expect CurrentBufferIsModule('os') == 0
|
||||||
|
" Without hidden, it's not possible to open a new buffer, when the old
|
||||||
|
" one is not saved.
|
||||||
|
set hidden
|
||||||
|
call jedi#goto_assignments()
|
||||||
|
Expect CurrentBufferIsModule('os') == 1
|
||||||
|
Expect winnr('$') == 1
|
||||||
|
Expect tabpagenr('$') == 1
|
||||||
|
Expect line('.') == 1
|
||||||
|
Expect col('.') == 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
describe 'goto with splits'
|
||||||
|
before
|
||||||
|
enew!
|
||||||
|
set filetype=python
|
||||||
|
let g:jedi#use_splits_not_buffers = 'left'
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'follow import'
|
||||||
|
put = ['import subprocess', 'subprocess']
|
||||||
|
normal G\g
|
||||||
|
Expect getline('.') == 'import subprocess'
|
||||||
|
Expect line('.') == 2
|
||||||
|
Expect col('.') == 8
|
||||||
|
|
||||||
|
normal G\d
|
||||||
|
Expect CurrentBufferIsModule('subprocess') == 1
|
||||||
|
Expect line('.') == 1
|
||||||
|
Expect col('.') == 1
|
||||||
|
Expect winnr('$') == 2
|
||||||
|
wincmd l
|
||||||
|
Expect bufname('%') == ''
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe 'goto wildignore'
|
||||||
|
before
|
||||||
|
enew!
|
||||||
|
set filetype=python
|
||||||
|
set wildignore=*,with\ spaces,*.pyc
|
||||||
|
set hidden
|
||||||
|
let g:jedi#use_tag_stack = 1
|
||||||
|
let g:jedi#use_tabs_not_buffers = 0
|
||||||
|
" Need to use splits for code coverage in new_buffer()
|
||||||
|
let g:jedi#use_splits_not_buffers = 1
|
||||||
|
|
||||||
|
put = ['from subprocess import Popen', 'Popen']
|
||||||
|
Expect CurrentBufferIsModule('subprocess') == 0
|
||||||
|
normal G
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
set wildignore&vim
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'restores wildignore'
|
||||||
|
let before = &wildignore
|
||||||
|
call jedi#goto()
|
||||||
|
Expect getline('.') =~ 'Popen'
|
||||||
|
Expect &wildignore == before
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'not using tagstack'
|
||||||
|
let g:jedi#use_tag_stack = 0
|
||||||
|
call jedi#goto()
|
||||||
|
Expect CurrentBufferIsModule('subprocess') == 1
|
||||||
|
Expect getline('.') =~ 'Popen'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
13
test/vspec/jedi_debug_info.vim
Normal file
13
test/vspec/jedi_debug_info.vim
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
source plugin/jedi.vim
|
||||||
|
|
||||||
|
describe 'JediDebugInfo'
|
||||||
|
it 'works'
|
||||||
|
redir @a | JediDebugInfo | redir END
|
||||||
|
let output = split(@a, '\n')
|
||||||
|
Expect output[0] == 'You should run this in a buffer with filetype "python".'
|
||||||
|
Expect output[1] == '#### Jedi-vim debug information'
|
||||||
|
Expect output[-1] == '</details>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
" vim: et:ts=4:sw=4
|
||||||
34
test/vspec/pyimport.vim
Normal file
34
test/vspec/pyimport.vim
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
source plugin/jedi.vim
|
||||||
|
source test/_utils.vim
|
||||||
|
|
||||||
|
describe 'pyimport'
|
||||||
|
before
|
||||||
|
let g:jedi#use_tabs_not_buffers = 1
|
||||||
|
let g:jedi#project_path = 'autoload'
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
unlet g:jedi#project_path
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'open_tab'
|
||||||
|
Pyimport os
|
||||||
|
Expect CurrentBufferIsModule('os') == 1
|
||||||
|
Pyimport subprocess
|
||||||
|
Expect CurrentBufferIsModule('subprocess') == 1
|
||||||
|
" the empty tab is sometimes also a tab
|
||||||
|
Expect tabpagenr('$') >= 2
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'completion'
|
||||||
|
" don't know how to test this directly
|
||||||
|
"execute "Pyimport subproc\<Tab>"
|
||||||
|
"Expect CurrentBufferIsModule('subprocess') == 1
|
||||||
|
|
||||||
|
Expect jedi#py_import_completions('subproc', 0, 0) == 'subprocess'
|
||||||
|
Expect jedi#py_import_completions('subprocess', 0, 0) == 'subprocess'
|
||||||
|
let g:comp = jedi#py_import_completions('sre_', 0, 0)
|
||||||
|
Expect g:comp == "sre_compile\nsre_constants\nsre_parse"
|
||||||
|
end
|
||||||
|
end
|
||||||
143
test/vspec/signatures.vim
Normal file
143
test/vspec/signatures.vim
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
source plugin/jedi.vim
|
||||||
|
|
||||||
|
describe 'signatures'
|
||||||
|
before
|
||||||
|
enew
|
||||||
|
set filetype=python
|
||||||
|
end
|
||||||
|
|
||||||
|
after
|
||||||
|
try | %bwipeout! | catch | endtry
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'simple'
|
||||||
|
normal odef xyz(number): return
|
||||||
|
normal o
|
||||||
|
normal oxyz()
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
Expect getline(3) == '?!?jedi=0, ?!? (*_*number*_*) ?!?jedi?!?'
|
||||||
|
|
||||||
|
doautocmd InsertLeave
|
||||||
|
Expect getline(3) == ''
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'multiple buffers'
|
||||||
|
set hidden
|
||||||
|
new
|
||||||
|
setfiletype python
|
||||||
|
redir => autocmds
|
||||||
|
autocmd jedi_call_signatures * <buffer>
|
||||||
|
redir END
|
||||||
|
Expect autocmds =~# 'jedi_call_signatures'
|
||||||
|
buffer #
|
||||||
|
redir => autocmds
|
||||||
|
autocmd jedi_call_signatures * <buffer>
|
||||||
|
redir END
|
||||||
|
Expect autocmds =~# 'jedi_call_signatures'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'simple after CursorHoldI with only parenthesis'
|
||||||
|
noautocmd normal o
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
noautocmd normal istaticmethod()
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
Expect getline(1) == '?!?jedi=0, ?!? (*_*f: Callable[..., Any]*_*) ?!?jedi?!?'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'highlights correct argument'
|
||||||
|
noautocmd normal o
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
noautocmd normal iformat(42, "x")
|
||||||
|
" Move to x - highlights "x".
|
||||||
|
noautocmd normal 2h
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
Expect getline(1) == '?!?jedi=0, ?!? (value: object, *_*format_spec: str=...*_*) ?!?jedi?!?'
|
||||||
|
" Move left to 42 - hightlights first argument ("value").
|
||||||
|
noautocmd normal 4h
|
||||||
|
doautocmd CursorHoldI
|
||||||
|
Expect getline(1) == '?!?jedi=0, ?!? (*_*value: object*_*, format_spec: str=...) ?!?jedi?!?'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'no signature'
|
||||||
|
exe 'normal ostr '
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
Expect getline(1, '$') == ['', 'str ']
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'signatures disabled'
|
||||||
|
let g:jedi#show_call_signatures = 0
|
||||||
|
|
||||||
|
exe 'normal ostr( '
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
Expect getline(1, '$') == ['', 'str( ']
|
||||||
|
|
||||||
|
let g:jedi#show_call_signatures = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'command line simple'
|
||||||
|
let g:jedi#show_call_signatures = 2
|
||||||
|
call jedi#configure_call_signatures()
|
||||||
|
|
||||||
|
exe 'normal ostaticmethod( '
|
||||||
|
redir => msg
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
redir END
|
||||||
|
Expect msg == "\nstaticmethod(f: Callable[..., Any])"
|
||||||
|
|
||||||
|
redir => msg
|
||||||
|
doautocmd InsertLeave
|
||||||
|
redir END
|
||||||
|
Expect msg == "\n"
|
||||||
|
|
||||||
|
normal Sdef foo(a, b): pass
|
||||||
|
exe 'normal ofoo(a, b, c, '
|
||||||
|
redir => msg
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
redir END
|
||||||
|
Expect msg == "\nfoo(a, b)"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'command line truncation'
|
||||||
|
let g:jedi#show_call_signatures = 2
|
||||||
|
call jedi#configure_call_signatures()
|
||||||
|
|
||||||
|
function! Signature()
|
||||||
|
redir => msg
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
redir END
|
||||||
|
return msg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let funcname = repeat('a', &columns - (30 + (&ruler ? 18 : 0)))
|
||||||
|
put = 'def '.funcname.'(arg1, arg2, arg3, a, b, c):'
|
||||||
|
put = ' pass'
|
||||||
|
execute "normal o\<BS>".funcname."( "
|
||||||
|
Expect Signature() == "\n".funcname."(arg1, …)"
|
||||||
|
|
||||||
|
exe 'normal sarg1, '
|
||||||
|
Expect Signature() == "\n".funcname."(…, arg2, …)"
|
||||||
|
|
||||||
|
exe 'normal sarg2, arg3, '
|
||||||
|
Expect Signature() == "\n".funcname."(…, a, b, c)"
|
||||||
|
|
||||||
|
exe 'normal sa, b, '
|
||||||
|
Expect Signature() == "\n".funcname."(…, c)"
|
||||||
|
|
||||||
|
g/^/d
|
||||||
|
put = 'def '.funcname.'('.repeat('b', 20).', arg2):'
|
||||||
|
put = ' pass'
|
||||||
|
execute "normal o\<BS>".funcname."( "
|
||||||
|
Expect Signature() == "\n".funcname."(…)"
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'command line no signature'
|
||||||
|
let g:jedi#show_call_signatures = 2
|
||||||
|
call jedi#configure_call_signatures()
|
||||||
|
|
||||||
|
exe 'normal ostr '
|
||||||
|
redir => msg
|
||||||
|
python3 jedi_vim.show_call_signatures()
|
||||||
|
redir END
|
||||||
|
Expect msg == "\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user