Commit graph

271 commits

Author SHA1 Message Date
Paul Gauthier
b5cd5f0e23 Use a thread to import slow modules in the background 2024-07-03 13:55:29 -03:00
Paul Gauthier
5e0ff7627e Defer loading of networkx 2024-07-03 13:17:04 -03:00
Paul Gauthier
c020d94d5f 8x repomap when finding files; fix max_input_tokens 2024-06-26 04:14:51 +00:00
Paul Gauthier
965c35870c Notice if the user mentions the basename of a filename; fixes to repomap context 2024-06-24 15:12:58 -07:00
Paul Gauthier
0d9150c77b coq for languages.md 2024-06-05 20:24:19 -07:00
Paul Gauthier
a4a6066858 handle missing max_map_tokens/max_context_window 2024-05-23 13:46:08 -07:00
Paul Gauthier
6345cd3734 cleanup 2024-05-23 13:43:35 -07:00
Paul Gauthier
56f5e7e10c expand repomap even in smaller context windows 2024-05-21 11:04:18 -07:00
Paul Gauthier
1effd73e80 Only expand the repomap if we know it will fit into context window 2024-05-20 10:22:57 -07:00
Paul Gauthier
819fccc7a4 added temp param, prompt strong that files message is truth 2024-05-16 08:52:30 -07:00
Paul Gauthier
ecc46bd3e3 16x 2024-05-14 14:04:45 -07:00
Paul Gauthier
dea93bbfd9 mentioned_idents 2024-05-14 12:18:48 -07:00
Paul Gauthier
e5616c0247 mentioned_fnames 2024-05-14 11:52:32 -07:00
Paul Gauthier
73e6949287 refac 2024-05-14 11:12:36 -07:00
Paul Gauthier
851e98a398 added tree cache 2024-05-14 10:32:16 -07:00
Paul Gauthier
3251380364 refac 2024-05-14 10:23:53 -07:00
Paul Gauthier
370f668955 remove useless noqa 2024-05-14 06:02:40 -07:00
Paul Gauthier
e96420f999 fix to ignore long (!) lines in repomap 2024-05-14 06:01:24 -07:00
Paul Gauthier
292250db4f prompt and token adjustments when no files in chat with repo 2024-05-13 12:30:42 -07:00
Paul Gauthier
1d55f749fb cleanup 2024-05-08 13:56:40 -07:00
Paul Gauthier
9e7f2ec790 cleanup 2024-05-08 13:41:24 -07:00
Paul Gauthier
f256b43043 wip 2024-05-08 13:35:34 -07:00
Paul Gauthier
f0f0c330d7 cleanup 2024-04-19 12:14:58 -07:00
Paul Gauthier
547ae142ba refactor tokenizer 2024-04-19 12:08:35 -07:00
Paul Gauthier
3449f7da42 quiet tree-sitter warnings 2024-04-18 16:36:56 -07:00
Paul Gauthier
65400981c5 aider: Replace deprecated pkg_resources.resource_filename with importlib.resources.files for accessing package resources in Python 3.9+.
# Aider chat conversation:

USER: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

ASSISTANT: To address the `DeprecationWarning` regarding `pkg_resources`, we will replace its usage with the recommended `importlib.resources` or `importlib.metadata` from the Python standard library. The specific replacement depends on the original use case of `pkg_resources`. In the provided code, `pkg_resources` is used to access package data, so we will use `importlib.resources`.

Here are the diffs for the necessary changes:

```diff
--- aider/repomap.py
+++ aider/repomap.py
@@ ... @@
 import networkx as nx
-import pkg_resources
+import importlib.resources as pkg_resources
 from diskcache import Cache
 from grep_ast import TreeContext, filename_to_lang
 from pygments.lexers import guess_lexer_for_filename
 from pygments.token import Token
 from pygments.util import ClassNotFound
@@ ... @@
         # Load the tags queries
         try:
-            scm_fname = pkg_resources.resource_filename(
-                __name__, os.path.join("queries", f"tree-sitter-{lang}-tags.scm")
-            )
+            scm_fname = pkg_resources.files(__package__).joinpath(
+                "queries", f"tree-sitter-{lang}-tags.scm"
+            )
         except KeyError:
             return
-        query_scm = Path(scm_fname)
+        query_scm = scm_fname
         if not query_scm.exists():
             return
         query_scm = query_scm.read_text()
```

These changes replace the deprecated `pkg_resources.resource_filename` with `importlib.resources.files`, which is the recommended way to access package resources in Python 3.9 and later. The `files()` function returns a `Path`-like object that can be used to read the contents of the resource.
2024-04-18 16:30:10 -07:00
Paul Gauthier
c9bb22d6d5 roughed in tokenizer, dropped openai, openrouter 2024-04-17 15:22:35 -07:00
Paul Gauthier
8f98f3b430 Handle languages without tags.scm files #514 2024-03-22 10:14:22 -07:00
Paul Gauthier
f37488447f handle RecursionError 2024-01-02 10:12:44 -08:00
Paul Gauthier
d54f883698 do not include added files in the repo map #315 2023-11-15 13:06:22 -08:00
Paul Gauthier
f0c575e413 use io.read_text to avoid unicode errors in repomap #305 2023-11-02 09:30:59 -07:00
Paul Gauthier
5edf20915f updated sample map 2023-10-22 15:06:35 -07:00
Paul Gauthier
93fd53263e handle encoding 2023-10-19 13:16:53 -07:00
Paul Gauthier
a941c5cb82 cache tags 2023-10-19 13:13:48 -07:00
Paul Gauthier
5b99281d86 refac 2023-10-19 13:10:29 -07:00
Paul Gauthier
ce3099fa8b Fall back to the pygments lexer for refs if tree-sitter only provides defs 2023-10-19 12:54:27 -07:00
Paul Gauthier
551dddd746 handle languages where tree-sitter only has definition tags 2023-10-19 12:25:01 -07:00
Paul Gauthier
cb8d9d6a64 Merge branch 'main' into sitter-map 2023-10-19 10:09:22 -07:00
Paul Gauthier
cd30e531be better warnings on files that are missing or not normal 2023-10-19 10:09:16 -07:00
Paul Gauthier
cba883d4cd fix sorting and whitespace in map 2023-10-19 08:15:28 -07:00
Paul Gauthier
0291a99257 use rel_fname 2023-10-19 08:10:45 -07:00
Paul Gauthier
cff5534fab show_top_of_file_parent_scope 2023-10-19 08:07:59 -07:00
Paul Gauthier
9750fcd04a copy 2023-10-18 16:28:20 -07:00
Paul Gauthier
4c2125d289 cleanup 2023-10-18 16:18:59 -07:00
Paul Gauthier
2a1255ed07 cleanup 2023-10-18 16:12:07 -07:00
Paul Gauthier
40d702abd1 cleanup 2023-10-18 16:06:12 -07:00
Paul Gauthier
c0375d3328 fix tests; fix off-by-one bug in output of repomap 2023-10-18 15:42:38 -07:00
Paul Gauthier
10b856e0af cleanup 2023-10-18 15:18:12 -07:00
Paul Gauthier
2c98ea4448 Merge branch 'main' into sitter-map 2023-10-18 15:04:55 -07:00
Paul Gauthier
bf154b548e Only warn once about non-files being excluded from the repo map #281 2023-10-18 10:15:07 -07:00