scai
Version:
> **A local-first AI CLI for understanding, querying, and iterating on large codebases.** > **100% local • No token costs • No cloud • No prompt injection • Private by design**
81 lines (80 loc) • 1.87 kB
JavaScript
// utils/commentMap.ts
export const commentMap = {
javascript: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
typescript: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
java: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
c: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
cpp: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
csharp: {
singleLine: ["//"],
multiLine: [{ start: "/*", end: "*/" }]
},
python: {
singleLine: ["#"],
multiLine: [
{ start: `"""`, end: `"""` },
{ start: `'''`, end: `'''` }
]
},
ruby: {
singleLine: ["#"],
multiLine: [{ start: `=begin`, end: `=end` }]
},
shell: {
singleLine: ["#"]
},
bash: {
singleLine: ["#"]
},
html: {
singleLine: [],
multiLine: [{ start: "<!--", end: "-->" }]
},
css: {
singleLine: [],
multiLine: [{ start: "/*", end: "*/" }]
},
sql: {
singleLine: ["--"],
multiLine: []
},
xml: {
singleLine: [],
multiLine: [{ start: "<!--", end: "-->" }]
},
json: {
singleLine: [],
multiLine: [{ start: "/*", end: "*/" }]
},
markdown: {
singleLine: [],
multiLine: [{ start: "<!--", end: "-->" }]
},
text: {
singleLine: ["#"]
}
};
/**
* Returns the CommentSyntax for a given language.
* Falls back to single-line `#` if language is unknown.
*/
export function getCommentSyntax(language) {
const normalized = language.toLowerCase();
return (commentMap[normalized] ||
{ singleLine: ["//"], multiLine: ["/*", "*/"] });
}