Skip to content

Commit

Permalink
chore: change log
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinhuish committed Dec 11, 2024
1 parent b52ab67 commit d4c75f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/definition/langs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class Language {
*/
public setAvailableComments(comments: AvailableComments) {
this.availableComments = comments;
log.info(`(${this.id}) set available comments, line: ${comments.lineComments.join('、')}; block: ${comments.blockComments.map(c => `${c[0]} ${c[1]}`).join('、')};`);
return this;
}

Expand Down
24 changes: 1 addition & 23 deletions src/handler/langs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export abstract class Handler {

constructor(languageId: string) {
this.languageId = languageId;
log.info(`handler created for languageId (${languageId})`);
log.info(`(${languageId}) decoration handler created`);
}

public abstract updateDecorations(editor: vscode.TextEditor): Promise<void>;
Expand Down Expand Up @@ -69,23 +69,12 @@ export interface PickDecorationOptionsParams {
processed: [number, number][];
}

const _missingLineComments = new Set<string>();
function logMissingLineComments(languageId: string) {
if (_missingLineComments.has(languageId)) {
return;
}

_missingLineComments.add(languageId);
log.warn(`Missing line comments for language (${languageId})`);
}

export async function pickLineCommentDecorationOptions({ editor, processed = [] }: PickDecorationOptionsParams) {
const decorationOptions = new Map<string, vscode.DecorationOptions[]>();

const comments = await definition.getAvailableComments(editor.document.languageId);

if (!comments.lineComments || !comments.lineComments.length) {
logMissingLineComments(editor.document.languageId);
return decorationOptions;
}

Expand Down Expand Up @@ -181,23 +170,12 @@ export async function pickLineCommentDecorationOptions({ editor, processed = []
return decorationOptions;
}

const _missingBlockComments = new Set<string>();
function logMissingBlockComments(languageId: string) {
if (_missingBlockComments.has(languageId)) {
return;
}

_missingBlockComments.add(languageId);
log.warn(`Missing block comments for language (${languageId})`);
}

export async function pickBlockCommentDecorationOptions({ editor, processed = [] }: PickDecorationOptionsParams) {
const decorationOptions = new Map<string, vscode.DecorationOptions[]>();

const comments = await definition.getAvailableComments(editor.document.languageId);

if (!comments.blockComments || !comments.blockComments.length) {
logMissingBlockComments(editor.document.languageId);
return decorationOptions;
}

Expand Down

0 comments on commit d4c75f9

Please sign in to comment.