Skip to content

Commit bb6f79e

Browse files
authored
Merge pull request #53 from mathworks/dklilley/release/1.2.7
MATLAB language server - v1.2.7
2 parents 2245fbe + c98bd0d commit bb6f79e

File tree

106 files changed

+43768
-4433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+43768
-4433
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ MATLAB language server supports these editors by installing the corresponding ex
2828

2929
### Unreleased
3030

31+
### 1.2.7
32+
Release date: 2024-11-07
33+
34+
Added:
35+
* Allow specifying the maximum file size for code analysis through the `maxFileSizeForAnalysis` setting
36+
* Linting support in untitled files and in MATLAB files with different file extensions
37+
3138
### 1.2.6
3239
Release date: 2024-09-20
3340

build/copyLicensingToOut.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2024 The MathWorks, Inc.
2+
const fs = require('fs')
3+
const path = require('path')
4+
5+
const sourceDir = path.join(__dirname, '..', 'src', 'licensing', 'gui', 'build')
6+
const targetDir = path.join(__dirname, '..', 'out', 'licensing', 'static')
7+
8+
fs.cp(sourceDir, targetDir, { recursive: true }, (err) => {
9+
if (err) {
10+
console.error('Error copying files: ', err)
11+
} else {
12+
console.log('Files copied successfully.')
13+
}
14+
})

build/makeLicensingOut.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2024 The MathWorks, Inc.
2+
const fs = require('fs')
3+
const path = require('path')
4+
5+
const dirPath = path.join(__dirname, '..', 'out', 'licensing', 'static')
6+
7+
fs.mkdir(dirPath, { recursive: true }, (err) => {
8+
if (err) {
9+
console.error('Error creating directory: ', err)
10+
} else {
11+
console.log('Directory created successfully: ', dirPath)
12+
}
13+
})

matlab/+matlabls/+handlers/IndexingHandler.m

+15-13
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function handleDocumentIndexRequest (this, msg)
2525

2626
code = msg.code;
2727
filePath = msg.filePath;
28+
analysisLimit = msg.analysisLimit;
2829

29-
codeData = matlabls.internal.computeCodeData(code, filePath);
30+
codeData = matlabls.internal.computeCodeData(code, filePath, analysisLimit);
3031

3132
responseChannel = strcat(this.DocumentIndexingResponseChannel, '/', msg.channelId);
3233
matlabls.internal.CommunicationManager.publish(responseChannel, codeData)
@@ -36,9 +37,10 @@ function handleFolderIndexRequest (this, msg)
3637
% Indexes M-files the provided folders
3738

3839
folders = msg.folders;
40+
analysisLimit = msg.analysisLimit;
3941

4042
files = this.getAllMFilesToIndex(folders);
41-
this.parseFiles(msg.channelId, files)
43+
this.parseFiles(msg.channelId, files, analysisLimit)
4244
end
4345

4446
function filesToIndex = getAllMFilesToIndex (~, folders)
@@ -56,30 +58,30 @@ function handleFolderIndexRequest (this, msg)
5658
end
5759
end
5860

59-
function parseFiles (this, requestId, files)
61+
function parseFiles (this, requestId, files, analysisLimit)
6062
% Processes the given list of files and sends the data back to the language server.
6163

6264
if isMATLABReleaseOlderThan('R2021b')
6365
% If backgroundPool doesn't exist, leverage a timer to avoid blocking thread
64-
this.doParseFilesWithTimer(this, requestId, files);
66+
this.doParseFilesWithTimer(this, requestId, files, analysisLimit);
6567
else
66-
parfeval(backgroundPool, @this.doParseFiles, 0, requestId, files);
68+
parfeval(backgroundPool, @this.doParseFiles, 0, requestId, files, analysisLimit);
6769
end
6870
end
6971

70-
function doParseFilesWithTimer (this, requestId, files, index)
72+
function doParseFilesWithTimer (this, requestId, files, analysisLimit, index)
7173
% This leverages a timer to achieve an "asynchronous" looping effect, allowing
7274
% other operations to take place between parsing each file. This prevents the MATLAB®
7375
% thread from becomming blocked for an extended period of time.
7476

75-
if nargin == 3
77+
if nargin == 4
7678
index = 1;
7779
end
7880

7981
filePath = files(index);
8082
isLastFile = index == numel(files);
8183

82-
this.parseFile(requestId, filePath, isLastFile);
84+
this.parseFile(requestId, filePath, isLastFile, analysisLimit);
8385

8486
if ~isLastFile
8587
% More files - queue next file to parse
@@ -93,26 +95,26 @@ function timerCallback (t, ~)
9395
t.delete();
9496

9597
% Parse next file
96-
this.parseFiles(requestId, files, index + 1);
98+
this.doParseFilesWithTimer(requestId, files, analysisLimit, index + 1);
9799
end
98100
end
99101

100-
function doParseFiles (this, requestId, files)
102+
function doParseFiles (this, requestId, files, analysisLimit)
101103
% This can be executed in a separate thread (e.g. parfeval) to avoid blocking the
102104
% MATLAB thread.
103105

104106
for n = 1:numel(files)
105107
filePath = files{n};
106108
isLastFile = n == numel(files);
107-
this.parseFile(requestId, filePath, isLastFile);
109+
this.parseFile(requestId, filePath, isLastFile, analysisLimit);
108110
end
109111
end
110112

111-
function parseFile (this, requestId, filePath, isLastFile)
113+
function parseFile (this, requestId, filePath, isLastFile, analysisLimit)
112114
% Parses the given file and sends its data back to the language server
113115

114116
code = fileread(filePath);
115-
codeData = matlabls.internal.computeCodeData(code, filePath);
117+
codeData = matlabls.internal.computeCodeData(code, filePath, analysisLimit);
116118

117119
% Send data for this file
118120
msg.filePath = filePath;
20 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)