mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-04 14:40:53 +00:00
feat: improve code completion git diff context
This commit is contained in:
parent
78fa38ca13
commit
4e147dc62c
5 changed files with 43 additions and 56 deletions
|
|
@ -36,9 +36,13 @@ import org.treesitter.TreeSitterYaml;
|
|||
|
||||
public class CodeCompletionParserFactory {
|
||||
|
||||
public static CodeCompletionParser getParserForFileExtension(String extension)
|
||||
throws IllegalArgumentException {
|
||||
return new CodeCompletionParser(getLanguageForExtension(extension));
|
||||
public static CodeCompletionParser getParserForFileExtension(String extension) {
|
||||
var language = getLanguageForExtension(extension);
|
||||
if (language == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CodeCompletionParser(language);
|
||||
}
|
||||
|
||||
private static TSLanguage getLanguageForExtension(String extension) {
|
||||
|
|
@ -75,7 +79,7 @@ public class CodeCompletionParserFactory {
|
|||
case "svelte" -> new TreeSitterSvelte();
|
||||
case "swift" -> new TreeSitterSwift();
|
||||
case "yml", "yaml" -> new TreeSitterYaml();
|
||||
default -> throw new IllegalArgumentException("Unsupported file extension: " + extension);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue