Skip to content

Commit 11a02ae

Browse files
committed
v1.3.5 commit
1 parent 7f50a01 commit 11a02ae

31 files changed

+1185
-56
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ MATLAB language server implements several Language Server Protocol features and
1818
* Document symbols — [documentSymbolProvider](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol)
1919
* Symbol rename - [renameProvider](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_rename)
2020
* Code folding - [foldingRangeProvider](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_foldingRange)
21+
* Document highlights - [highlightSymbolProvider](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentHighlight)
2122

2223
## Clients
2324
MATLAB language server supports these editors by installing the corresponding extension:
@@ -29,6 +30,15 @@ MATLAB language server supports these editors by installing the corresponding ex
2930

3031
### Unreleased
3132

33+
### 1.3.5
34+
Release date: 2025-09-04
35+
36+
Fixed:
37+
* Resolves an issue where newly saved document contents are ignored during execution
38+
39+
Added:
40+
* Support for highlighting all references to a selected function, variable, class, or class property
41+
3242
### 1.3.4
3343
Release date: 2025-07-31
3444

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
% Copyright 2025 The MathWorks, Inc.
2+
3+
% Clears any temporary changes made in matlab.editor settings associated with the matlab.defaultEditor config
4+
function clearTemporaryEditorSettings()
5+
s = settings;
6+
if hasTemporaryValue(s.matlab.editor.UseMATLABEditor)
7+
clearTemporaryValue(s.matlab.editor.UseMATLABEditor);
8+
clearTemporaryValue(s.matlab.editor.OtherEditor);
9+
end
10+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
% Copyright 2025 The MathWorks, Inc.
2+
3+
% Temporarily sets default editor to the provided executablePath when matlab.defaultEditor config is enabled using the matlab.editor settings
4+
function setTemporaryEditorSettings(executablePath)
5+
s = settings;
6+
s.matlab.editor.UseMATLABEditor.TemporaryValue = 0;
7+
s.matlab.editor.OtherEditor.TemporaryValue = executablePath;
8+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function saveHelper(filePath)
2+
% This function is triggered after documents are saved, and can be used to
3+
% trigger behaviors when this occurs.
4+
5+
% Copyright 2025 The MathWorks, Inc.
6+
7+
% Ensure that changes to the file are registered by MATLAB to prevent cached
8+
% file contents from being used during execution.
9+
fschange(filePath);
10+
clear(filePath);
11+
end

matlab/+matlabls/setupShadows.m

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function setupShadows(languageServerFolder)
2+
currentDirectory = pwd;
3+
cleanup = onCleanup(@() cd(currentDirectory));
4+
5+
try
6+
addRestoreDefaultPathShadow(languageServerFolder);
7+
addEditShadow(languageServerFolder);
8+
addClcShadow(languageServerFolder);
9+
catch ME
10+
disp('Error while attempting to add shadow directories to path')
11+
disp(ME.message)
12+
end
13+
end
14+
15+
function addRestoreDefaultPathShadow(languageServerFolder)
16+
cd(fullfile(matlabroot, 'toolbox', 'local'));
17+
originalRestoreDefaultPath = @restoredefaultpath;
18+
cd(matlabroot);
19+
addpath(fullfile(languageServerFolder, 'shadows', 'restoredefaultpath'));
20+
21+
restoredefaultpath('__SET__', originalRestoreDefaultPath, @handleReset);
22+
23+
function handleReset()
24+
addpath(languageServerFolder)
25+
matlabls.setupShadows(languageServerFolder)
26+
end
27+
end
28+
29+
function addEditShadow(languageServerFolder)
30+
cd(fullfile(matlabroot, 'toolbox', 'matlab', 'codetools'));
31+
originalEdit = @edit;
32+
cd(matlabroot);
33+
addpath(fullfile(languageServerFolder, 'shadows', 'edit'));
34+
35+
% Need to pass the originalEdit function handle in within a cell array
36+
% to avoid @function_handle/edit being used instead.
37+
edit('__SET__', {originalEdit});
38+
end
39+
40+
function addClcShadow(languageServerFolder)
41+
% Only need to do this for <R2023a
42+
if isMATLABReleaseOlderThan('R2023a')
43+
addpath(fullfile(languageServerFolder, 'shadows', 'clc'));
44+
end
45+
end

matlab/initmatlabls.m

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function initmatlabls (outFile)
1313
% Ensure the language server code is on the path
1414
folder = fileparts(mfilename('fullpath'));
1515

16-
updatePath(folder);
16+
% Shadow necessary functions
17+
matlabls.setupShadows(folder);
1718

1819
try
1920
s = settings;
@@ -69,28 +70,3 @@ function logConnectionData (outFile)
6970
end
7071

7172
end
72-
73-
function updatePath(languageServerFolder)
74-
addpath(languageServerFolder)
75-
76-
try
77-
addRestoreDefaultPathShadow(languageServerFolder);
78-
79-
if isMATLABReleaseOlderThan('R2023a')
80-
addpath(fullfile(languageServerFolder, 'shadows', 'clc'));
81-
end
82-
catch ME
83-
disp('Error while attempting to add shadow directory to path')
84-
disp(ME.message)
85-
end
86-
end
87-
88-
function addRestoreDefaultPathShadow(languageServerFolder)
89-
currentDirectory = pwd;
90-
cd(fullfile(matlabroot, 'toolbox', 'local'));
91-
originalRestoreDefaultPath = @restoredefaultpath;
92-
cd(matlabroot);
93-
addpath(fullfile(languageServerFolder, 'shadows', 'restoredefaultpath'));
94-
restoredefaultpath('SET', originalRestoreDefaultPath, @() updatePath(languageServerFolder));
95-
cd(currentDirectory);
96-
end

matlab/shadows/edit/edit.m

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
% Copyright 2025 The MathWorks, Inc.
2+
3+
function edit(varargin)
4+
mlock
5+
persistent originalEdit;
6+
7+
if nargin == 2 && ischar(varargin{1}) && isequal(varargin{1}, '__SET__')
8+
originalEdit = varargin{2}{1};
9+
return;
10+
end
11+
12+
if (isempty(originalEdit))
13+
error('MATLAB:edit:UninitializedShadow', ...
14+
'MATLAB Language Server - Edit shadow is uninitialized.');
15+
end
16+
17+
if (nargin == 0 && ~settings().matlab.editor.UseMATLABEditor.ActiveValue)
18+
error('MATLAB:edit:NoArgsNotAllowed', ...
19+
'Calling `edit` with no arguments is not supported when opening files outside of MATLAB.');
20+
end
21+
22+
originalEdit(varargin{:});
23+
end

matlab/shadows/restoredefaultpath/restoredefaultpath.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
% Copyright 2025 The MathWorks, Inc.
2+
13
function restoredefaultpath(varargin)
24
mlock
35
persistent originalRestoreDefaultPath;
46
persistent pathUpdateFunction;
5-
if nargin == 3 && ischar(varargin{1}) && isequal(varargin{1}, 'SET')
7+
if nargin == 3 && ischar(varargin{1}) && isequal(varargin{1}, '__SET__')
68
originalRestoreDefaultPath = varargin{2};
79
pathUpdateFunction = varargin{3};
810
return;
911
end
1012

1113
if isempty(originalRestoreDefaultPath)
12-
error('Matlab Language Server - RestoreDefaultPath shadow is uninitialized.');
14+
error('MATLAB Language Server - RestoreDefaultPath shadow is uninitialized.');
1315
end
1416

1517
originalRestoreDefaultPath();

package-lock.json

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matlab-language-server",
3-
"version": "1.3.4",
3+
"version": "1.3.5",
44
"description": "Language Server for MATLAB code",
55
"main": "./src/index.ts",
66
"bin": "./out/index.js",
@@ -42,6 +42,7 @@
4242
"eslint-plugin-promise": "^6.0.1",
4343
"mocha": "^10.4.0",
4444
"node-loader": "^2.0.0",
45+
"quibble": "^0.9.2",
4546
"sinon": "^18.0.0",
4647
"ts-loader": "^9.4.1",
4748
"tsx": "^4.19.4",

0 commit comments

Comments
 (0)