setta 0.0.1.dev0__py3-none-any.whl → 0.0.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. setta/__init__.py +1 -1
  2. setta/cli/__init__.py +1 -0
  3. setta/cli/connect.py +43 -0
  4. setta/cli/logger.py +225 -0
  5. setta/code_gen/__init__.py +0 -0
  6. setta/code_gen/create_runnable_scripts.py +466 -0
  7. setta/code_gen/export_selected.py +776 -0
  8. setta/code_gen/find_placeholders.py +13 -0
  9. setta/code_gen/python/__init__.py +0 -0
  10. setta/code_gen/python/ast_utils.py +183 -0
  11. setta/code_gen/python/check_scope.py +187 -0
  12. setta/code_gen/python/generate_code.py +280 -0
  13. setta/code_gen/python/make_parseable.py +97 -0
  14. setta/code_gen/python/position_line_col.py +33 -0
  15. setta/code_gen/python/validate_imports.py +87 -0
  16. setta/code_gen/utils.py +120 -0
  17. setta/code_gen/yaml/__init__.py +0 -0
  18. setta/code_gen/yaml/generate_yaml.py +23 -0
  19. setta/code_gen/yaml/section_dict.py +93 -0
  20. setta/database/__init__.py +0 -0
  21. setta/database/backup.py +80 -0
  22. setta/database/db/__init__.py +0 -0
  23. setta/database/db/artifacts/__init__.py +0 -0
  24. setta/database/db/artifacts/load.py +93 -0
  25. setta/database/db/artifacts/save.py +85 -0
  26. setta/database/db/artifacts/save_or_create.py +68 -0
  27. setta/database/db/artifacts/utils.py +13 -0
  28. setta/database/db/codeInfo/__init__.py +0 -0
  29. setta/database/db/codeInfo/copy.py +26 -0
  30. setta/database/db/codeInfo/load.py +65 -0
  31. setta/database/db/codeInfo/save.py +75 -0
  32. setta/database/db/codeInfo/utils.py +33 -0
  33. setta/database/db/evRefs/__init__.py +0 -0
  34. setta/database/db/evRefs/load.py +45 -0
  35. setta/database/db/evRefs/save.py +95 -0
  36. setta/database/db/projects/__init__.py +0 -0
  37. setta/database/db/projects/copy.py +36 -0
  38. setta/database/db/projects/delete.py +7 -0
  39. setta/database/db/projects/load.py +184 -0
  40. setta/database/db/projects/save.py +267 -0
  41. setta/database/db/projects/saveAs.py +40 -0
  42. setta/database/db/projects/utils.py +135 -0
  43. setta/database/db/sectionVariants/__init__.py +0 -0
  44. setta/database/db/sectionVariants/copy.py +28 -0
  45. setta/database/db/sectionVariants/load.py +139 -0
  46. setta/database/db/sectionVariants/save.py +140 -0
  47. setta/database/db/sectionVariants/utils.py +44 -0
  48. setta/database/db/sections/__init__.py +0 -0
  49. setta/database/db/sections/copy.py +70 -0
  50. setta/database/db/sections/jsonSource.py +119 -0
  51. setta/database/db/sections/load.py +350 -0
  52. setta/database/db/sections/save.py +204 -0
  53. setta/database/db/sections/utils.py +13 -0
  54. setta/database/db/uiTypes/__init__.py +0 -0
  55. setta/database/db/uiTypes/copy.py +33 -0
  56. setta/database/db/uiTypes/load.py +51 -0
  57. setta/database/db/uiTypes/save.py +99 -0
  58. setta/database/db/uiTypes/utils.py +27 -0
  59. setta/database/db_init.py +36 -0
  60. setta/database/db_objs.py +102 -0
  61. setta/database/db_path.py +8 -0
  62. setta/database/export_db/__init__.py +0 -0
  63. setta/database/export_db/export_db.py +43 -0
  64. setta/database/export_db/export_raw.py +53 -0
  65. setta/database/export_db/export_readable.py +242 -0
  66. setta/database/export_db/utils.py +16 -0
  67. setta/database/import_db.py +28 -0
  68. setta/database/seed.py +41 -0
  69. setta/database/settings_file.py +118 -0
  70. setta/database/utils.py +32 -0
  71. setta/lsp/__init__.py +0 -0
  72. setta/lsp/file_watcher.py +113 -0
  73. setta/lsp/reader.py +184 -0
  74. setta/lsp/reader_fns/__init__.py +0 -0
  75. setta/lsp/reader_fns/completion.py +84 -0
  76. setta/lsp/reader_fns/definition.py +2 -0
  77. setta/lsp/reader_fns/diagnostics.py +99 -0
  78. setta/lsp/reader_fns/documentHighlight.py +25 -0
  79. setta/lsp/reader_fns/references.py +34 -0
  80. setta/lsp/reader_fns/signatureHelp.py +99 -0
  81. setta/lsp/server.py +150 -0
  82. setta/lsp/utils.py +60 -0
  83. setta/lsp/writer.py +306 -0
  84. setta/routers/__init__.py +11 -0
  85. setta/routers/artifact.py +105 -0
  86. setta/routers/code_info.py +32 -0
  87. setta/routers/dependencies.py +49 -0
  88. setta/routers/in_memory_fn_stdout_websocket.py +21 -0
  89. setta/routers/interactive.py +119 -0
  90. setta/routers/lsp.py +14 -0
  91. setta/routers/projects.py +188 -0
  92. setta/routers/reference_renaming.py +111 -0
  93. setta/routers/sections.py +174 -0
  94. setta/routers/settings.py +40 -0
  95. setta/routers/terminals.py +83 -0
  96. setta/routers/websocket.py +36 -0
  97. setta/server.py +141 -0
  98. setta/start.py +112 -0
  99. setta/static/constants/BaseUITypes.json +153 -0
  100. setta/static/constants/Settings.json +113 -0
  101. setta/static/constants/constants.json +117 -0
  102. setta/static/constants/db_init.sql +249 -0
  103. setta/static/constants/defaultValues.json +125 -0
  104. setta/static/constants/settingsProject.json +276 -0
  105. setta/static/frontend/android-chrome-192x192.png +0 -0
  106. setta/static/frontend/android-chrome-512x512.png +0 -0
  107. setta/static/frontend/apple-touch-icon.png +0 -0
  108. setta/static/frontend/assets/KaTeX_AMS-Regular-0cdd387c.woff2 +0 -0
  109. setta/static/frontend/assets/KaTeX_AMS-Regular-30da91e8.woff +0 -0
  110. setta/static/frontend/assets/KaTeX_AMS-Regular-68534840.ttf +0 -0
  111. setta/static/frontend/assets/KaTeX_Caligraphic-Bold-07d8e303.ttf +0 -0
  112. setta/static/frontend/assets/KaTeX_Caligraphic-Bold-1ae6bd74.woff +0 -0
  113. setta/static/frontend/assets/KaTeX_Caligraphic-Bold-de7701e4.woff2 +0 -0
  114. setta/static/frontend/assets/KaTeX_Caligraphic-Regular-3398dd02.woff +0 -0
  115. setta/static/frontend/assets/KaTeX_Caligraphic-Regular-5d53e70a.woff2 +0 -0
  116. setta/static/frontend/assets/KaTeX_Caligraphic-Regular-ed0b7437.ttf +0 -0
  117. setta/static/frontend/assets/KaTeX_Fraktur-Bold-74444efd.woff2 +0 -0
  118. setta/static/frontend/assets/KaTeX_Fraktur-Bold-9163df9c.ttf +0 -0
  119. setta/static/frontend/assets/KaTeX_Fraktur-Bold-9be7ceb8.woff +0 -0
  120. setta/static/frontend/assets/KaTeX_Fraktur-Regular-1e6f9579.ttf +0 -0
  121. setta/static/frontend/assets/KaTeX_Fraktur-Regular-51814d27.woff2 +0 -0
  122. setta/static/frontend/assets/KaTeX_Fraktur-Regular-5e28753b.woff +0 -0
  123. setta/static/frontend/assets/KaTeX_Main-Bold-0f60d1b8.woff2 +0 -0
  124. setta/static/frontend/assets/KaTeX_Main-Bold-138ac28d.ttf +0 -0
  125. setta/static/frontend/assets/KaTeX_Main-Bold-c76c5d69.woff +0 -0
  126. setta/static/frontend/assets/KaTeX_Main-BoldItalic-70ee1f64.ttf +0 -0
  127. setta/static/frontend/assets/KaTeX_Main-BoldItalic-99cd42a3.woff2 +0 -0
  128. setta/static/frontend/assets/KaTeX_Main-BoldItalic-a6f7ec0d.woff +0 -0
  129. setta/static/frontend/assets/KaTeX_Main-Italic-0d85ae7c.ttf +0 -0
  130. setta/static/frontend/assets/KaTeX_Main-Italic-97479ca6.woff2 +0 -0
  131. setta/static/frontend/assets/KaTeX_Main-Italic-f1d6ef86.woff +0 -0
  132. setta/static/frontend/assets/KaTeX_Main-Regular-c2342cd8.woff2 +0 -0
  133. setta/static/frontend/assets/KaTeX_Main-Regular-c6368d87.woff +0 -0
  134. setta/static/frontend/assets/KaTeX_Main-Regular-d0332f52.ttf +0 -0
  135. setta/static/frontend/assets/KaTeX_Math-BoldItalic-850c0af5.woff +0 -0
  136. setta/static/frontend/assets/KaTeX_Math-BoldItalic-dc47344d.woff2 +0 -0
  137. setta/static/frontend/assets/KaTeX_Math-BoldItalic-f9377ab0.ttf +0 -0
  138. setta/static/frontend/assets/KaTeX_Math-Italic-08ce98e5.ttf +0 -0
  139. setta/static/frontend/assets/KaTeX_Math-Italic-7af58c5e.woff2 +0 -0
  140. setta/static/frontend/assets/KaTeX_Math-Italic-8a8d2445.woff +0 -0
  141. setta/static/frontend/assets/KaTeX_SansSerif-Bold-1ece03f7.ttf +0 -0
  142. setta/static/frontend/assets/KaTeX_SansSerif-Bold-e99ae511.woff2 +0 -0
  143. setta/static/frontend/assets/KaTeX_SansSerif-Bold-ece03cfd.woff +0 -0
  144. setta/static/frontend/assets/KaTeX_SansSerif-Italic-00b26ac8.woff2 +0 -0
  145. setta/static/frontend/assets/KaTeX_SansSerif-Italic-3931dd81.ttf +0 -0
  146. setta/static/frontend/assets/KaTeX_SansSerif-Italic-91ee6750.woff +0 -0
  147. setta/static/frontend/assets/KaTeX_SansSerif-Regular-11e4dc8a.woff +0 -0
  148. setta/static/frontend/assets/KaTeX_SansSerif-Regular-68e8c73e.woff2 +0 -0
  149. setta/static/frontend/assets/KaTeX_SansSerif-Regular-f36ea897.ttf +0 -0
  150. setta/static/frontend/assets/KaTeX_Script-Regular-036d4e95.woff2 +0 -0
  151. setta/static/frontend/assets/KaTeX_Script-Regular-1c67f068.ttf +0 -0
  152. setta/static/frontend/assets/KaTeX_Script-Regular-d96cdf2b.woff +0 -0
  153. setta/static/frontend/assets/KaTeX_Size1-Regular-6b47c401.woff2 +0 -0
  154. setta/static/frontend/assets/KaTeX_Size1-Regular-95b6d2f1.ttf +0 -0
  155. setta/static/frontend/assets/KaTeX_Size1-Regular-c943cc98.woff +0 -0
  156. setta/static/frontend/assets/KaTeX_Size2-Regular-2014c523.woff +0 -0
  157. setta/static/frontend/assets/KaTeX_Size2-Regular-a6b2099f.ttf +0 -0
  158. setta/static/frontend/assets/KaTeX_Size2-Regular-d04c5421.woff2 +0 -0
  159. setta/static/frontend/assets/KaTeX_Size3-Regular-500e04d5.ttf +0 -0
  160. setta/static/frontend/assets/KaTeX_Size3-Regular-6ab6b62e.woff +0 -0
  161. setta/static/frontend/assets/KaTeX_Size4-Regular-99f9c675.woff +0 -0
  162. setta/static/frontend/assets/KaTeX_Size4-Regular-a4af7d41.woff2 +0 -0
  163. setta/static/frontend/assets/KaTeX_Size4-Regular-c647367d.ttf +0 -0
  164. setta/static/frontend/assets/KaTeX_Typewriter-Regular-71d517d6.woff2 +0 -0
  165. setta/static/frontend/assets/KaTeX_Typewriter-Regular-e14fed02.woff +0 -0
  166. setta/static/frontend/assets/KaTeX_Typewriter-Regular-f01f3e87.ttf +0 -0
  167. setta/static/frontend/assets/cormorant-garamond-all-700-italic-c9b58582.woff +0 -0
  168. setta/static/frontend/assets/cormorant-garamond-cyrillic-700-italic-9101ad5f.woff2 +0 -0
  169. setta/static/frontend/assets/cormorant-garamond-cyrillic-ext-700-italic-950de0d6.woff2 +0 -0
  170. setta/static/frontend/assets/cormorant-garamond-latin-700-italic-0bc53e12.woff2 +0 -0
  171. setta/static/frontend/assets/cormorant-garamond-latin-ext-700-italic-525738e0.woff2 +0 -0
  172. setta/static/frontend/assets/cormorant-garamond-vietnamese-700-italic-99563037.woff2 +0 -0
  173. setta/static/frontend/assets/erase-5e0448ea.svg +15 -0
  174. setta/static/frontend/assets/index-1d4b4ecf.css +32 -0
  175. setta/static/frontend/assets/index-ee99dc72.js +678 -0
  176. setta/static/frontend/assets/inter-all-400-normal-054f12d0.woff +0 -0
  177. setta/static/frontend/assets/inter-all-600-normal-c03769e5.woff +0 -0
  178. setta/static/frontend/assets/inter-all-800-normal-15dc6e4b.woff +0 -0
  179. setta/static/frontend/assets/inter-cyrillic-400-normal-a4eee61a.woff2 +0 -0
  180. setta/static/frontend/assets/inter-cyrillic-600-normal-8b14f703.woff2 +0 -0
  181. setta/static/frontend/assets/inter-cyrillic-800-normal-e706eaaa.woff2 +0 -0
  182. setta/static/frontend/assets/inter-cyrillic-ext-400-normal-70047a3b.woff2 +0 -0
  183. setta/static/frontend/assets/inter-cyrillic-ext-600-normal-d4ab9bc4.woff2 +0 -0
  184. setta/static/frontend/assets/inter-cyrillic-ext-800-normal-eae7515a.woff2 +0 -0
  185. setta/static/frontend/assets/inter-greek-400-normal-381ea30d.woff2 +0 -0
  186. setta/static/frontend/assets/inter-greek-600-normal-601f93a2.woff2 +0 -0
  187. setta/static/frontend/assets/inter-greek-800-normal-7af4fb64.woff2 +0 -0
  188. setta/static/frontend/assets/inter-greek-ext-400-normal-27027b17.woff2 +0 -0
  189. setta/static/frontend/assets/inter-greek-ext-600-normal-f2ddf9de.woff2 +0 -0
  190. setta/static/frontend/assets/inter-greek-ext-800-normal-4cb6189e.woff2 +0 -0
  191. setta/static/frontend/assets/inter-latin-400-normal-d56fec21.woff2 +0 -0
  192. setta/static/frontend/assets/inter-latin-600-normal-ff769fa6.woff2 +0 -0
  193. setta/static/frontend/assets/inter-latin-800-normal-5eea1309.woff2 +0 -0
  194. setta/static/frontend/assets/inter-latin-ext-400-normal-bb698d85.woff2 +0 -0
  195. setta/static/frontend/assets/inter-latin-ext-600-normal-ca4808f9.woff2 +0 -0
  196. setta/static/frontend/assets/inter-latin-ext-800-normal-ebdacc0f.woff2 +0 -0
  197. setta/static/frontend/assets/logo/logo.svg +8 -0
  198. setta/static/frontend/assets/pen-455d7d8a.svg +19 -0
  199. setta/static/frontend/assets/source-code-pro-all-500-normal-6bdaa03b.woff +0 -0
  200. setta/static/frontend/assets/source-code-pro-cyrillic-500-normal-288a0d68.woff2 +0 -0
  201. setta/static/frontend/assets/source-code-pro-cyrillic-ext-500-normal-b110a13b.woff2 +0 -0
  202. setta/static/frontend/assets/source-code-pro-greek-500-normal-04328acb.woff2 +0 -0
  203. setta/static/frontend/assets/source-code-pro-latin-500-normal-06edef1e.woff2 +0 -0
  204. setta/static/frontend/assets/source-code-pro-latin-ext-500-normal-6dc60d5e.woff2 +0 -0
  205. setta/static/frontend/assets/web-vitals-44a8e082.js +1 -0
  206. setta/static/frontend/assets/work-sans-all-400-normal-38034a3c.woff +0 -0
  207. setta/static/frontend/assets/work-sans-all-500-normal-550d64e5.woff +0 -0
  208. setta/static/frontend/assets/work-sans-all-600-normal-ccf14060.woff +0 -0
  209. setta/static/frontend/assets/work-sans-all-700-normal-494c2971.woff +0 -0
  210. setta/static/frontend/assets/work-sans-latin-400-normal-36735bc1.woff2 +0 -0
  211. setta/static/frontend/assets/work-sans-latin-500-normal-3790bfda.woff2 +0 -0
  212. setta/static/frontend/assets/work-sans-latin-600-normal-5fba494e.woff2 +0 -0
  213. setta/static/frontend/assets/work-sans-latin-700-normal-a5033d0a.woff2 +0 -0
  214. setta/static/frontend/assets/work-sans-latin-ext-400-normal-c20f571a.woff2 +0 -0
  215. setta/static/frontend/assets/work-sans-latin-ext-500-normal-0f5ac96c.woff2 +0 -0
  216. setta/static/frontend/assets/work-sans-latin-ext-600-normal-97a237d1.woff2 +0 -0
  217. setta/static/frontend/assets/work-sans-latin-ext-700-normal-103e112c.woff2 +0 -0
  218. setta/static/frontend/browserconfig.xml +9 -0
  219. setta/static/frontend/favicon-16x16.png +0 -0
  220. setta/static/frontend/favicon-32x32.png +0 -0
  221. setta/static/frontend/favicon.ico +0 -0
  222. setta/static/frontend/index.html +30 -0
  223. setta/static/frontend/manifest.json +25 -0
  224. setta/static/frontend/mstile-144x144.png +0 -0
  225. setta/static/frontend/mstile-150x150.png +0 -0
  226. setta/static/frontend/mstile-310x150.png +0 -0
  227. setta/static/frontend/mstile-310x310.png +0 -0
  228. setta/static/frontend/mstile-70x70.png +0 -0
  229. setta/static/frontend/robots.txt +3 -0
  230. setta/static/frontend/safari-pinned-tab.svg +18 -0
  231. setta/static/frontend/site.webmanifest +19 -0
  232. setta/static/seed/.DS_Store +0 -0
  233. setta/static/seed/examples/.DS_Store +0 -0
  234. setta/tasks/__init__.py +0 -0
  235. setta/tasks/fns/__init__.py +9 -0
  236. setta/tasks/fns/codeAreaAutocomplete.py +209 -0
  237. setta/tasks/fns/codeAreaFindTemplateVars.py +128 -0
  238. setta/tasks/fns/codeAreaInitializeCode.py +98 -0
  239. setta/tasks/fns/findEVRefs.py +236 -0
  240. setta/tasks/fns/parametersRequest.py +71 -0
  241. setta/tasks/fns/textFieldAutocomplete.py +210 -0
  242. setta/tasks/fns/textFieldInitializeCode.py +99 -0
  243. setta/tasks/fns/typeCheck.py +40 -0
  244. setta/tasks/fns/utils.py +134 -0
  245. setta/tasks/task_runner.py +29 -0
  246. setta/tasks/tasks.py +152 -0
  247. setta/tasks/utils.py +178 -0
  248. setta/terminals/__init__.py +0 -0
  249. setta/terminals/terminals.py +242 -0
  250. setta/terminals/utils.py +37 -0
  251. setta/utils/__init__.py +0 -0
  252. setta/utils/constants.py +148 -0
  253. setta/utils/generate_memorable_string.py +431 -0
  254. setta/utils/generate_new_filename.py +80 -0
  255. setta/utils/section_contents.py +133 -0
  256. setta/utils/utils.py +271 -0
  257. setta/utils/websocket_manager.py +91 -0
  258. setta-0.0.2.dist-info/LICENSE +201 -0
  259. setta-0.0.2.dist-info/METADATA +24 -0
  260. setta-0.0.2.dist-info/RECORD +263 -0
  261. {setta-0.0.1.dev0.dist-info → setta-0.0.2.dist-info}/WHEEL +1 -1
  262. setta-0.0.2.dist-info/entry_points.txt +2 -0
  263. setta-0.0.1.dev0.dist-info/METADATA +0 -18
  264. setta-0.0.1.dev0.dist-info/RECORD +0 -5
  265. {setta-0.0.1.dev0.dist-info → setta-0.0.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,8 @@
1
+ <svg width="237" height="99" viewBox="0 0 237 99" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M177.36 41.3772C177.36 35.647 178.426 30.6165 180.558 26.2855C182.757 21.9546 185.722 18.6231 189.453 16.291C193.184 13.959 197.349 12.793 201.946 12.793C205.877 12.793 209.309 13.5925 212.241 15.1916C215.239 16.7908 217.538 18.8896 219.137 21.4882V13.5925H236.227V69.3618H219.137V61.4661C217.471 64.0647 215.139 66.1636 212.141 67.7627C209.209 69.3618 205.778 70.1613 201.846 70.1613C197.316 70.1613 193.184 68.9953 189.453 66.6633C185.722 64.2646 182.757 60.8998 180.558 56.5688C178.426 52.1713 177.36 47.1074 177.36 41.3772ZM219.137 41.4772C219.137 37.2128 217.937 33.848 215.539 31.3827C213.207 28.9174 210.342 27.6848 206.944 27.6848C203.545 27.6848 200.647 28.9174 198.248 31.3827C195.916 33.7814 194.75 37.1129 194.75 41.3772C194.75 45.6415 195.916 49.0397 198.248 51.5716C200.647 54.0369 203.545 55.2696 206.944 55.2696C210.342 55.2696 213.207 54.0369 215.539 51.5716C217.937 49.1063 219.137 45.7415 219.137 41.4772Z" fill="#4CE2FF"/>
3
+ <path d="M176.827 54.8697V69.3618H168.131C161.935 69.3618 157.104 67.8626 153.639 64.8642C150.175 61.7993 148.442 56.8353 148.442 49.9724V27.7847H141.646V13.5925H148.442V0H165.533V13.5925H176.727V27.7847H165.533V50.1723C165.533 51.8381 165.933 53.0374 166.732 53.7704C167.532 54.5033 168.864 54.8697 170.73 54.8697H176.827Z" fill="#4CE2FF"/>
4
+ <path d="M140.222 54.8697V69.3618H131.527C125.33 69.3618 120.499 67.8626 117.035 64.8642C113.57 61.7993 111.838 56.8353 111.838 49.9724V27.7847H105.041V13.5925H111.838V0H128.928V13.5925H140.122V27.7847H128.928V50.1723C128.928 51.8381 129.328 53.0374 130.127 53.7704C130.927 54.5033 132.26 54.8697 134.125 54.8697H140.222Z" fill="#4CE2FF"/>
5
+ <path d="M104.916 40.5777C104.916 42.1768 104.816 43.8425 104.616 45.5749H65.9377C66.2042 49.0397 67.3036 51.7049 69.2358 53.5705C71.2347 55.3695 73.6667 56.269 76.5318 56.269C80.7961 56.269 83.7612 54.47 85.4269 50.872H103.617C102.684 54.5366 100.985 57.8348 98.5197 60.7665C96.121 63.6982 93.0894 65.997 89.4247 67.6627C85.7601 69.3285 81.6623 70.1613 77.1315 70.1613C71.6678 70.1613 66.8038 68.9953 62.5395 66.6633C58.2752 64.3312 54.9437 60.9997 52.545 56.6688C50.1464 52.3378 48.947 47.274 48.947 41.4772C48.947 35.6804 50.113 30.6165 52.4451 26.2855C54.8438 21.9546 58.1753 18.6231 62.4396 16.291C66.7039 13.959 71.6012 12.793 77.1315 12.793C82.5285 12.793 87.3259 13.9257 91.5235 16.1911C95.7212 18.4565 98.9861 21.6881 101.318 25.8858C103.717 30.0834 104.916 34.9807 104.916 40.5777ZM87.4258 36.0801C87.4258 33.1484 86.4264 30.8164 84.4275 29.084C82.4286 27.3516 79.9299 26.4854 76.9316 26.4854C74.0665 26.4854 71.6345 27.3183 69.6356 28.984C67.7033 30.6498 66.504 33.0152 66.0376 36.0801H87.4258Z" fill="#4CE2FF"/>
6
+ <path d="M25.6858 70.1613C20.8219 70.1613 16.4909 69.3285 12.693 67.6627C8.8951 65.997 5.89675 63.7316 3.69796 60.8665C1.49917 57.9348 0.26652 54.6699 0 51.0719H16.8907C17.0906 53.0041 17.9901 54.5699 19.5892 55.7693C21.1883 56.9686 23.1539 57.5683 25.4859 57.5683C27.6181 57.5683 29.2505 57.1685 30.3832 56.3689C31.5826 55.5028 32.1823 54.4034 32.1823 53.0708C32.1823 51.4716 31.3494 50.3056 29.6836 49.5727C28.0179 48.7731 25.3194 47.9069 21.5881 46.9741C17.5903 46.0413 14.2588 45.0752 11.5936 44.0757C8.92841 43.0096 6.62968 41.3772 4.69741 39.1784C2.76514 36.913 1.79901 33.8813 1.79901 30.0834C1.79901 26.8852 2.6652 23.9868 4.39758 21.3882C6.19658 18.723 8.79515 16.6242 12.1933 15.0917C15.658 13.5592 19.7558 12.793 24.4865 12.793C31.4826 12.793 36.9796 14.5253 40.9774 17.9901C45.0418 21.4549 47.3739 26.0523 47.9735 31.7825H32.1823C31.9157 29.8502 31.0495 28.3177 29.5837 27.185C28.1845 26.0523 26.3188 25.486 23.9868 25.486C21.9879 25.486 20.4554 25.8858 19.3893 26.6853C18.3232 27.4182 17.7902 28.451 17.7902 29.7836C17.7902 31.3827 18.6231 32.5821 20.2888 33.3816C22.0212 34.1812 24.6864 34.9807 28.2844 35.7803C32.4155 36.8464 35.7803 37.9125 38.3788 38.9785C40.9774 39.978 43.2428 41.6437 45.1751 43.9758C47.174 46.2412 48.2068 49.3062 48.2734 53.1707C48.2734 56.4356 47.3406 59.3673 45.4749 61.9659C43.6759 64.4978 41.044 66.4967 37.5793 67.9626C34.1812 69.4284 30.2167 70.1613 25.6858 70.1613Z" fill="#4CE2FF"/>
7
+ <rect y="86" width="48" height="13" fill="#4CE2FF"/>
8
+ </svg>
@@ -0,0 +1,19 @@
1
+ <svg
2
+ width="24"
3
+ height="24"
4
+ viewBox="0 0 24 24"
5
+ fill="white"
6
+ style="fill:white; filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.4));"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ >
9
+ <path
10
+ fill-rule="evenodd"
11
+ clip-rule="evenodd"
12
+ d="M21.2635 2.29289C20.873 1.90237 20.2398 1.90237 19.8493 2.29289L18.9769 3.16525C17.8618 2.63254 16.4857 2.82801 15.5621 3.75165L4.95549 14.3582L10.6123 20.0151L21.2189 9.4085C22.1426 8.48486 22.338 7.1088 21.8053 5.99367L22.6777 5.12132C23.0682 4.7308 23.0682 4.09763 22.6777 3.70711L21.2635 2.29289ZM16.9955 10.8035L10.6123 17.1867L7.78392 14.3582L14.1671 7.9751L16.9955 10.8035ZM18.8138 8.98525L19.8047 7.99429C20.1953 7.60376 20.1953 6.9706 19.8047 6.58007L18.3905 5.16586C18 4.77534 17.3668 4.77534 16.9763 5.16586L15.9853 6.15683L18.8138 8.98525Z"
13
+ fill="white"
14
+ />
15
+ <path
16
+ d="M2 22.9502L4.12171 15.1717L9.77817 20.8289L2 22.9502Z"
17
+ fill="white"
18
+ />
19
+ </svg>
@@ -0,0 +1 @@
1
+ var m,l,C,h,f=function(n,e){return{name:n,value:e===void 0?-1:e,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},T=function(n,e){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){if(n==="first-input"&&!("PerformanceEventTiming"in self))return;var i=new PerformanceObserver(function(r){return r.getEntries().map(e)});return i.observe({type:n,buffered:!0}),i}}catch{}},y=function(n,e){var i=function r(t){t.type!=="pagehide"&&document.visibilityState!=="hidden"||(n(t),e&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))};addEventListener("visibilitychange",i,!0),addEventListener("pagehide",i,!0)},g=function(n){addEventListener("pageshow",function(e){e.persisted&&n(e)},!0)},v=function(n,e,i){var r;return function(t){e.value>=0&&(t||i)&&(e.delta=e.value-(r||0),(e.delta||r===void 0)&&(r=e.value,n(e)))}},d=-1,w=function(){return document.visibilityState==="hidden"?0:1/0},F=function(){y(function(n){var e=n.timeStamp;d=e},!0)},L=function(){return d<0&&(d=w(),F(),g(function(){setTimeout(function(){d=w(),F()},0)})),{get firstHiddenTime(){return d}}},A=function(n,e){var i,r=L(),t=f("FCP"),o=function(c){c.name==="first-contentful-paint"&&(u&&u.disconnect(),c.startTime<r.firstHiddenTime&&(t.value=c.startTime,t.entries.push(c),i(!0)))},a=performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],u=a?null:T("paint",o);(a||u)&&(i=v(n,t,e),a&&o(a),g(function(c){t=f("FCP"),i=v(n,t,e),requestAnimationFrame(function(){requestAnimationFrame(function(){t.value=performance.now()-c.timeStamp,i(!0)})})}))},b=!1,E=-1,R=function(n,e){b||(A(function(s){E=s.value}),b=!0);var i,r=function(s){E>-1&&n(s)},t=f("CLS",0),o=0,a=[],u=function(s){if(!s.hadRecentInput){var B=a[0],q=a[a.length-1];o&&s.startTime-q.startTime<1e3&&s.startTime-B.startTime<5e3?(o+=s.value,a.push(s)):(o=s.value,a=[s]),o>t.value&&(t.value=o,t.entries=a,i())}},c=T("layout-shift",u);c&&(i=v(r,t,e),y(function(){c.takeRecords().map(u),i(!0)}),g(function(){o=0,E=-1,t=f("CLS",0),i=v(r,t,e)}))},p={passive:!0,capture:!0},H=new Date,P=function(n,e){m||(m=e,l=n,C=new Date,k(removeEventListener),D())},D=function(){if(l>=0&&l<C-H){var n={entryType:"first-input",name:m.type,target:m.target,cancelable:m.cancelable,startTime:m.timeStamp,processingStart:m.timeStamp+l};h.forEach(function(e){e(n)}),h=[]}},I=function(n){if(n.cancelable){var e=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;n.type=="pointerdown"?function(i,r){var t=function(){P(i,r),a()},o=function(){a()},a=function(){removeEventListener("pointerup",t,p),removeEventListener("pointercancel",o,p)};addEventListener("pointerup",t,p),addEventListener("pointercancel",o,p)}(e,n):P(e,n)}},k=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach(function(e){return n(e,I,p)})},M=function(n,e){var i,r=L(),t=f("FID"),o=function(u){u.startTime<r.firstHiddenTime&&(t.value=u.processingStart-u.startTime,t.entries.push(u),i(!0))},a=T("first-input",o);i=v(n,t,e),a&&y(function(){a.takeRecords().map(o),a.disconnect()},!0),a&&g(function(){var u;t=f("FID"),i=v(n,t,e),h=[],l=-1,m=null,k(addEventListener),u=o,h.push(u),D()})},S=new Set,N=function(n,e){var i,r=L(),t=f("LCP"),o=function(c){var s=c.startTime;s<r.firstHiddenTime&&(t.value=s,t.entries.push(c)),i()},a=T("largest-contentful-paint",o);if(a){i=v(n,t,e);var u=function(){S.has(t.id)||(a.takeRecords().map(o),a.disconnect(),S.add(t.id),i(!0))};["keydown","click"].forEach(function(c){addEventListener(c,u,{once:!0,capture:!0})}),y(u,!0),g(function(c){t=f("LCP"),i=v(n,t,e),requestAnimationFrame(function(){requestAnimationFrame(function(){t.value=performance.now()-c.timeStamp,S.add(t.id),i(!0)})})})}},O=function(n){var e,i=f("TTFB");e=function(){try{var r=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,o={entryType:"navigation",startTime:0};for(var a in t)a!=="navigationStart"&&a!=="toJSON"&&(o[a]=Math.max(t[a]-t.navigationStart,0));return o}();if(i.value=i.delta=r.responseStart,i.value<0)return;i.entries=[r],n(i)}catch{}},document.readyState==="complete"?setTimeout(e,0):addEventListener("pageshow",e)};export{R as getCLS,A as getFCP,M as getFID,N as getLCP,O as getTTFB};
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <browserconfig>
3
+ <msapplication>
4
+ <tile>
5
+ <square150x150logo src="/mstile-150x150.png"/>
6
+ <TileColor>#da532c</TileColor>
7
+ </tile>
8
+ </msapplication>
9
+ </browserconfig>
Binary file
Binary file
Binary file
@@ -0,0 +1,30 @@
1
+ <!doctype html>
2
+ <!-- Need overscroll-x-none: https://github.com/xyflow/xyflow/discussions/3379#discussioncomment-10171429 -->
3
+ <html lang="en" class="overscroll-x-none">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png" />
7
+ <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png" />
8
+ <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png" />
9
+ <link rel="manifest" href="/static/site.webmanifest" />
10
+ <link rel="mask-icon" href="/static/safari-pinned-tab.svg" color="#00b5d8" />
11
+ <meta name="msapplication-TileColor" content="#da532c" />
12
+ <meta name="theme-color" content="#00b5d8" />
13
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
14
+ <meta name="description" content="setta" />
15
+
16
+
17
+ <title>setta.dev</title>
18
+ <script type="module" crossorigin src="/static/assets/index-ee99dc72.js"></script>
19
+ <link rel="stylesheet" href="/static/assets/index-1d4b4ecf.css">
20
+ </head>
21
+ <body>
22
+ <noscript>You need to enable JavaScript to run this app.</noscript>
23
+ <main
24
+ id="root"
25
+ class="flex h-screen w-screen flex-col items-center bg-setta-light font-sans dark:bg-setta-dark"
26
+ ></main>
27
+
28
+
29
+ </body>
30
+ </html>
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5
+ width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
6
+ preserveAspectRatio="xMidYMid meet">
7
+ <metadata>
8
+ Created by potrace 1.14, written by Peter Selinger 2001-2017
9
+ </metadata>
10
+ <g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
11
+ fill="#000000" stroke="none">
12
+ <path d="M690 6986 c-344 -64 -607 -325 -676 -671 -11 -59 -13 -515 -11 -2840
13
+ 1 -1524 5 -2779 9 -2790 3 -11 9 -33 13 -50 58 -251 256 -477 506 -576 59 -23
14
+ 56 -22 149 -43 57 -13 427 -15 2840 -13 1526 1 2787 6 2801 10 204 56 303 109
15
+ 426 228 107 103 182 232 225 385 l23 79 2 2770 c2 2963 5 2823 -45 2965 -92
16
+ 263 -334 481 -593 536 -13 2 -44 9 -69 14 -72 15 -5519 11 -5600 -4z"/>
17
+ </g>
18
+ </svg>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "",
3
+ "short_name": "",
4
+ "icons": [
5
+ {
6
+ "src": "/android-chrome-192x192.png",
7
+ "sizes": "192x192",
8
+ "type": "image/png"
9
+ },
10
+ {
11
+ "src": "/android-chrome-512x512.png",
12
+ "sizes": "512x512",
13
+ "type": "image/png"
14
+ }
15
+ ],
16
+ "theme_color": "#ffffff",
17
+ "background_color": "#ffffff",
18
+ "display": "standalone"
19
+ }
Binary file
Binary file
File without changes
@@ -0,0 +1,9 @@
1
+ from .codeAreaAutocomplete import codeAreaAutocomplete
2
+ from .codeAreaFindTemplateVars import codeAreaFindTemplateVars
3
+ from .codeAreaInitializeCode import codeAreaInitializeCode
4
+ from .findEVRefs import findEVRefs
5
+ from .parametersRequest import parametersRequest
6
+ from .textFieldAutocomplete import textFieldCompletion
7
+ from .textFieldInitializeCode import textFieldInitializeCode
8
+ from .typeCheck import typeCheck
9
+ from .utils import SettaInMemoryFn, TaskDefinition
@@ -0,0 +1,209 @@
1
+ from typing import Any, Optional
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from setta.code_gen.create_runnable_scripts import generate_final_code_for_section
6
+ from setta.code_gen.export_selected import get_gen_code_template_var
7
+ from setta.code_gen.find_placeholders import tp
8
+ from setta.code_gen.python.check_scope import are_positions_in_scope_with_variable
9
+ from setta.code_gen.python.generate_code import get_chars_in_line_before_position
10
+ from setta.code_gen.python.position_line_col import position_to_line_col
11
+ from setta.tasks.fns.codeAreaFindTemplateVars import findTemplateVarsLocally
12
+ from setta.tasks.fns.findEVRefs import findEVRefsLocally
13
+ from setta.tasks.task_runner import RunType
14
+ from setta.utils.constants import C
15
+
16
+ from .codeAreaInitializeCode import get_cache_key
17
+ from .utils import (
18
+ TaskDefinition,
19
+ prepare_code_for_scope_checking,
20
+ send_document_open_request_with_diagnostics,
21
+ )
22
+
23
+
24
+ class CodeAreaAutocompleteContent(BaseModel):
25
+ projectConfigId: str
26
+ projectConfigName: str
27
+ codeLanguage: str
28
+ sectionId: str
29
+ sectionName: str
30
+ fullText: str
31
+ position: int
32
+ candidateEVRefs: list
33
+ candidateTemplateVars: list
34
+ cached: Optional[Any] = None
35
+
36
+
37
+ async def _codeAreaAutocomplete(message, lsp_writers):
38
+ request_id = message.id
39
+ message = CodeAreaAutocompleteContent.parse_obj(message.content)
40
+
41
+ (
42
+ template_var_replacement_values,
43
+ generated_var_names,
44
+ referencable_var_names,
45
+ exporter_obj,
46
+ fullNameToInfo,
47
+ fullNameToSectionId,
48
+ ) = message.cached
49
+
50
+ templateVars = await findTemplateVarsLocally(
51
+ message.sectionId,
52
+ message.candidateTemplateVars,
53
+ message.fullText,
54
+ fullNameToSectionId,
55
+ lsp_writers,
56
+ )
57
+
58
+ gen_code_template_var = get_gen_code_template_var(templateVars)
59
+ if (
60
+ gen_code_template_var
61
+ and exporter_obj.code_gen_template_var_section_details["section"].get("id")
62
+ != message.sectionId
63
+ ):
64
+ return {"content": {"data": C.CODE_AREA_GEN_CODE_NOT_INITIALIZED}}
65
+
66
+ evRefs = await findEVRefsLocally(
67
+ message.sectionId,
68
+ None,
69
+ message.candidateEVRefs,
70
+ templateVars,
71
+ True,
72
+ message.fullText,
73
+ fullNameToInfo,
74
+ lsp_writers,
75
+ )
76
+
77
+ (
78
+ code,
79
+ _,
80
+ _,
81
+ ref_template_var_positions,
82
+ ) = await generate_final_code_for_section(
83
+ sectionId=message.sectionId,
84
+ code=message.fullText,
85
+ codeLanguage=message.codeLanguage,
86
+ evRefs=evRefs,
87
+ templateVars=templateVars,
88
+ exporter_obj=exporter_obj,
89
+ lsp_writers=lsp_writers,
90
+ folder_path=lsp_writers["full"].project_code_folder(message.projectConfigName),
91
+ cursor_position=message.position,
92
+ template_var_replacement_values=template_var_replacement_values,
93
+ )
94
+
95
+ cursor_position = ref_template_var_positions["cursor"]
96
+ line, column = position_to_line_col(code, cursor_position)
97
+
98
+ generated_var_names, referencable_var_names = calculate_referencable_var_names(
99
+ message.fullText, # use original code
100
+ templateVars, # use original template vars
101
+ message.position, # use original cursor position
102
+ generated_var_names,
103
+ referencable_var_names,
104
+ )
105
+
106
+ code_id = await send_document_open_request_with_diagnostics(
107
+ lsp_writers["full"],
108
+ code,
109
+ exporter_obj,
110
+ ref_template_var_positions,
111
+ message.projectConfigName,
112
+ message.sectionName,
113
+ message.sectionId,
114
+ )
115
+
116
+ await lsp_writers["full"].send_autocomplete_request(
117
+ line,
118
+ column,
119
+ code_id=code_id,
120
+ request_id=request_id,
121
+ referencable_var_names=referencable_var_names,
122
+ generated_var_names=generated_var_names,
123
+ cursor_offset=cursor_position - message.position,
124
+ )
125
+
126
+ return None
127
+
128
+
129
+ def calculate_referencable_var_names(
130
+ code,
131
+ original_template_vars,
132
+ original_cursor_position,
133
+ generated_var_names,
134
+ referencable_var_names,
135
+ ):
136
+ gen_code_template_var = get_gen_code_template_var(original_template_vars)
137
+ gen_code_position = (
138
+ gen_code_template_var["startPos"] if gen_code_template_var else None
139
+ )
140
+
141
+ if gen_code_position is None or original_cursor_position <= gen_code_position:
142
+ return [], special_keywords_for_autocomplete(gen_code_template_var)
143
+
144
+ code, the_special_var_name = prepare_code_for_scope_checking(
145
+ code, original_template_vars, gen_code_template_var
146
+ )
147
+
148
+ code = add_placeholder_to_empty_line_for_scope_checking(
149
+ code, original_cursor_position
150
+ )
151
+
152
+ response = are_positions_in_scope_with_variable(
153
+ code, [original_cursor_position], the_special_var_name
154
+ )
155
+
156
+ if response[0]:
157
+ referencable_var_names = [
158
+ *special_keywords_for_autocomplete(gen_code_template_var),
159
+ *referencable_var_names,
160
+ ]
161
+ return generated_var_names, referencable_var_names
162
+
163
+ return [], []
164
+
165
+
166
+ # The are_positions_in_scope_with_variable function doesn't work with empty lines
167
+ # So if the cursor is on an empty line, we add a dummy _
168
+ def add_placeholder_to_empty_line_for_scope_checking(code, cursor_position):
169
+ is_empty_line = False
170
+ before_chars = get_chars_in_line_before_position(code, cursor_position)
171
+
172
+ if len(before_chars.strip()) == 0:
173
+ line_end_index = code.find("\n", cursor_position)
174
+ if line_end_index == -1:
175
+ # Check remaining characters if we're at the last line
176
+ after_chars = code[cursor_position:]
177
+ else:
178
+ after_chars = code[cursor_position:line_end_index]
179
+
180
+ if len(after_chars.strip()) == 0:
181
+ is_empty_line = True
182
+
183
+ if is_empty_line:
184
+ code = code[:cursor_position] + "_" + code[cursor_position:]
185
+
186
+ return code
187
+
188
+
189
+ def special_keywords_for_autocomplete(gen_code_template_var):
190
+ if not gen_code_template_var:
191
+ return [tp(C.SETTA_GENERATED_PYTHON)]
192
+ return []
193
+
194
+
195
+ def read_cache(cache, message):
196
+ message = message.content
197
+ message["cached"] = cache.get(
198
+ get_cache_key(message["projectConfigId"], message["sectionId"])
199
+ )
200
+
201
+
202
+ codeAreaAutocomplete = TaskDefinition(
203
+ name="codeAreaAutocomplete",
204
+ return_message_type="codeAreaAutocompleteReturn",
205
+ fn=_codeAreaAutocomplete,
206
+ read_cache=read_cache,
207
+ run_as=RunType.NONE,
208
+ server_dependencies=["lsp_writers"],
209
+ )
@@ -0,0 +1,128 @@
1
+ import asyncio
2
+ from typing import List
3
+
4
+ from pydantic import BaseModel
5
+
6
+ from setta.code_gen.python.position_line_col import position_to_line_col
7
+ from setta.database.utils import create_new_id
8
+ from setta.tasks.task_runner import RunType
9
+
10
+ from .utils import TaskDefinition, replace_template_vars_with_random_names
11
+
12
+
13
+ class CodeAreaFindTemplateVarsContent(BaseModel):
14
+ sectionId: str
15
+ candidateTemplateVars: List[list]
16
+ fullText: str
17
+
18
+
19
+ async def _codeAreaFindTemplateVars(message, lsp_writers):
20
+ message_id = message.id
21
+ message = CodeAreaFindTemplateVarsContent.parse_obj(message.content)
22
+ request_ids = await sendTemplateVarRequests(
23
+ message_id,
24
+ message.sectionId,
25
+ message.candidateTemplateVars,
26
+ message.fullText,
27
+ lsp_writers,
28
+ local=False,
29
+ )
30
+ if len(request_ids) == 0:
31
+ return {"content": {"data": {"positions": [], "numMessages": 1}}}
32
+
33
+ return None
34
+
35
+
36
+ async def sendTemplateVarRequests(
37
+ message_id, sectionId, candidateTemplateVars, fullText, lsp_writers, local
38
+ ):
39
+ if len(candidateTemplateVars) == 0:
40
+ return []
41
+
42
+ code, positions_to_test, _ = replace_template_vars_with_random_names(
43
+ candidateTemplateVars, fullText
44
+ )
45
+ code_id = f"{sectionId}-find-template-vars"
46
+
47
+ await lsp_writers["basic"].send_document_open_request(code_id, code)
48
+ num_messages = len(positions_to_test)
49
+ request_ids = []
50
+ for idx in range(num_messages):
51
+ startPos = positions_to_test[idx]
52
+ line, col = position_to_line_col(code, startPos)
53
+ request_id = f"{message_id}-{idx}"
54
+ request_ids.append(request_id)
55
+ lsp_writers["basic"].create_asyncio_task(
56
+ lsp_writers["basic"].send_document_highlight_request(
57
+ line=line,
58
+ character=col,
59
+ code_id=code_id,
60
+ request_id=request_id,
61
+ return_id=message_id,
62
+ num_messages=num_messages,
63
+ ),
64
+ request_id,
65
+ local=local,
66
+ )
67
+
68
+ return request_ids
69
+
70
+
71
+ async def findTemplateVarsLocally(
72
+ sectionId,
73
+ candidateTemplateVars,
74
+ fullText,
75
+ fullNameToSectionId,
76
+ lsp_writers,
77
+ ):
78
+ templateVarRequestId = create_new_id()
79
+ request_ids = await sendTemplateVarRequests(
80
+ templateVarRequestId,
81
+ sectionId,
82
+ candidateTemplateVars,
83
+ fullText,
84
+ lsp_writers,
85
+ local=True,
86
+ )
87
+
88
+ if len(request_ids) == 0:
89
+ return []
90
+
91
+ responses = await waitForTemplateVarResponses(request_ids, lsp_writers)
92
+ positions = []
93
+ for r in responses:
94
+ positions.extend(r["data"]["positions"])
95
+ return construct_template_vars(positions, fullNameToSectionId, fullText)
96
+
97
+
98
+ def construct_template_vars(keyword_positions, fullNameToSectionId, fullText):
99
+ output = []
100
+ for k in keyword_positions:
101
+ keyword = fullText[k["startPos"] : k["endPos"]]
102
+ if keyword in fullNameToSectionId:
103
+ output.append(
104
+ {
105
+ "sectionId": fullNameToSectionId[keyword],
106
+ "startPos": k["startPos"],
107
+ "keyword": keyword,
108
+ }
109
+ )
110
+ return output
111
+
112
+
113
+ async def waitForTemplateVarResponses(request_ids, lsp_writers):
114
+ request_futures = []
115
+ for r in request_ids:
116
+ future = lsp_writers["basic"].wait_for_response(r)
117
+ request_futures.append(future)
118
+
119
+ return await asyncio.gather(*request_futures)
120
+
121
+
122
+ codeAreaFindTemplateVars = TaskDefinition(
123
+ name="codeAreaFindTemplateVars",
124
+ return_message_type="codeAreaFindTemplateVarsReturn",
125
+ fn=_codeAreaFindTemplateVars,
126
+ run_as=RunType.NONE,
127
+ server_dependencies=["lsp_writers"],
128
+ )