scai
Version:
> **AI-powered CLI for local code analysis, commit message suggestions, and natural-language queries.** 100% local, private, GDPR-friendly, made in Denmark/EU with ❤️.
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: ["/*", "*/"] });
}