Skip to content

Commit ad42b99

Browse files
committed
check for M-files instead of IPYNB files
1 parent 9aa56de commit ad42b99

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/providers/linting/LintingSupportProvider.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ class LintingSupportProvider {
9292
const matlabConnection = await this.matlabLifecycleManager.getMatlabConnection()
9393
const isMatlabAvailable = matlabConnection != null
9494

95-
const isIPYNBFile = this.isNotebookFile(uri)
96-
const fileName = isIPYNBFile ? "Notebook.m" : URI.parse(uri).fsPath
95+
const isMFile = this.isMFile(uri)
96+
const fileName = isMFile ? URI.parse(uri).fsPath : "untitled.m"
9797

9898
let lintData: string[] = []
9999

100100
if (isMatlabAvailable) {
101101
// Use MATLAB-based linting for better results and fixes
102102
const code = textDocument.getText()
103103
lintData = await this.getLintResultsFromMatlab(code, fileName, matlabConnection)
104-
} else if (!isIPYNBFile) {
104+
} else if (isMFile) {
105105
// Try to use mlint executable for basic linting
106106
lintData = await this.getLintResultsFromExecutable(fileName)
107107
}
@@ -531,13 +531,13 @@ class LintingSupportProvider {
531531
}
532532

533533
/**
534-
* Checks if the given URI corresponds to a Jupyter Notebook file.
534+
* Checks if the given URI corresponds to a MATLAB M-file.
535535
*
536536
* @param uri - The URI of the file to check.
537-
* @returns True if the file is a Jupyter Notebook (.ipynb), false otherwise.
537+
* @returns True if the file is a MATLAB M-file (.m), false otherwise.
538538
*/
539-
private isNotebookFile(uri: string): boolean {
540-
return URI.parse(uri).fsPath.endsWith(".ipynb")
539+
private isMFile(uri: string): boolean {
540+
return URI.parse(uri).fsPath.endsWith(".m")
541541
}
542542
}
543543

0 commit comments

Comments
 (0)