scai
Version:
> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.
80 lines (79 loc) • 1.85 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: [] };
}