Skip to content

Conversation

noritaka1166
Copy link
Contributor

I did the following refactoring.

  • replace deprecated substr with slice
  • use startsWith and endsWith for better readability
  • fix lint warning

@@ -136,7 +136,7 @@ function inferFilePath(documentOrUri: string | TextDocument | URI | undefined):
const extension = LanguageDefaults.getExtension(textDocument.languageId);
if (extension !== undefined) {
const extname = path.extname(filePath);
if (extname.length === 0 && filePath[0] === '.') {
if (extname.length === 0 && filePath.startsWith('.')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this better than the array access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaeumer
SonarQube, which I often use, says this, but do you prefer array access?

スクリーンショット 2025-08-17 午後10 59 10

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep the array access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaeumer
I reverted it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants