Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDE-Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DP-Group 14
IDE-Plugin
Commits
667f349e
Commit
667f349e
authored
3 years ago
by
Stekelenburg, A.V. (Alexander, Student )
Browse files
Options
Downloads
Patches
Plain Diff
Add a global list of progressHandlers
parent
c80a367f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/extension.ts
+9
-0
9 additions, 0 deletions
src/extension.ts
src/sidebar.ts
+6
-5
6 additions, 5 deletions
src/sidebar.ts
with
15 additions
and
5 deletions
src/extension.ts
+
9
−
0
View file @
667f349e
...
...
@@ -7,6 +7,7 @@ import {
import
{
LanguageClient
,
LanguageClientOptions
,
NotificationType
,
ServerOptions
,
State
,
Trace
,
...
...
@@ -15,6 +16,7 @@ import {
import
{
AnalysisResultsProvider
,
Result
}
from
"
./analysisResults
"
;
import
{
ModestCommands
}
from
"
./commands
"
;
import
{
getDocumentVars
,
initializeTools
,
ModestSidebarProvider
}
from
"
./sidebar
"
;
import
{
ResultNotification
}
from
"
./utils
"
;
export
let
client
:
LanguageClient
|
undefined
;
export
let
provider
:
ModestSidebarProvider
;
...
...
@@ -24,6 +26,7 @@ export let treeView: vscode.TreeView<Result>;
export
let
extensionUri
:
vscode
.
Uri
;
export
let
clientReady
:
boolean
=
false
;
export
let
disposalQueue
:
Array
<
vscode
.
Disposable
>
=
[];
export
let
resultHandlers
:
Array
<
(
notification
:
ResultNotification
)
=>
void
>
=
[];
export
function
modestExecutable
():
string
|
undefined
{
let
executable
:
string
|
undefined
=
vscode
.
workspace
...
...
@@ -126,7 +129,13 @@ function createClient(): LanguageClient | undefined {
client
.
onReady
().
then
(()
=>
{
initializeTools
();
clientReady
=
true
;
client
.
onNotification
(
new
NotificationType
<
ResultNotification
>
(
"
modest/toolResult
"
),
result
=>
{
resultHandlers
.
forEach
(
handler
=>
{
handler
(
result
);
});
});
});
return
client
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sidebar.ts
+
6
−
5
View file @
667f349e
...
...
@@ -8,7 +8,7 @@ import {
ProgressType
,
TextDocumentIdentifier
}
from
"
vscode-languageclient/node
"
;
import
{
analysisResultsProvider
,
client
,
clientReady
,
disposalQueue
,
provider
,
treeView
}
from
'
./extension
'
;
import
{
analysisResultsProvider
,
client
,
clientReady
,
disposalQueue
,
provider
,
resultHandlers
,
treeView
}
from
'
./extension
'
;
import
{
ParameterDefinitions
,
ProgressIndication
,
ResultNotification
,
getNonce
}
from
"
./utils
"
;
let
localToolNames
:
Array
<
string
>
|
undefined
;
...
...
@@ -125,7 +125,7 @@ function runTool(uri: string, toolName: string, constants: { name: string; value
progress
.
report
({
message
:
indication
.
message
,
increment
:
indication
.
progress
*
100
});
});
if
(
progressHandler
)
{
disposalQueue
.
push
(
progressHandler
);
}
let
resultHandler
=
client
?.
onNotification
(
new
NotificationType
<
ResultNotification
>
(
"
modest/toolResult
"
),
data
=>
{
let
resultHandler
=
(
data
:
ResultNotification
)
=>
{
if
(
data
.
progressToken
===
jsonObject
.
progressToken
)
{
if
(
data
.
data
&&
data
.
data
!==
""
)
{
try
{
...
...
@@ -146,14 +146,15 @@ function runTool(uri: string, toolName: string, constants: { name: string; value
}
}
progressHandler
?.
dispose
();
resultHandler
?.
dispose
(
);
resultHandler
s
.
splice
(
resultHandlers
.
indexOf
(
resultHandler
),
1
);
resolve
(
null
);
}
}
)
;
if
(
resultHandler
)
{
disposalQueue
.
push
(
resultHandler
);
}
};
resultHandler
s
.
push
(
resultHandler
);
disposalQueue
.
push
({
dispose
:
function
()
{
vscode
.
window
.
showErrorMessage
(
"
Language server restarting, operation cancelled
"
);
resultHandlers
.
splice
(
resultHandlers
.
indexOf
(
resultHandler
),
1
);
resolve
(
null
);
token
.
isCancellationRequested
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment