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
b5eadcf8
Commit
b5eadcf8
authored
4 years ago
by
Stekelenburg, A.V. (Alexander, Student )
Browse files
Options
Downloads
Patches
Plain Diff
Get language server location from configuration
parent
384ec875
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
package.json
+1
-2
1 addition, 2 deletions
package.json
src/commands.ts
+1
-19
1 addition, 19 deletions
src/commands.ts
src/extension.ts
+70
-12
70 additions, 12 deletions
src/extension.ts
with
72 additions
and
33 deletions
package.json
+
1
−
2
View file @
b5eadcf8
...
...
@@ -66,8 +66,7 @@
"properties"
:
{
"modest.executableLocation"
:
{
"type"
:
"string"
,
"default"
:
"C:
\\
Program Files
\\
modest
\\
modest.exe"
,
"description"
:
"Location of the Modest executable"
"description"
:
"Location of the Modest toolset executable"
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/commands.ts
+
1
−
19
View file @
b5eadcf8
import
{
pathToFileURL
}
from
'
url
'
;
import
{
provider
}
from
'
./extension
'
;
import
{
provider
,
modestExecutable
}
from
'
./extension
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
path
from
"
path
"
;
...
...
@@ -8,24 +8,6 @@ export namespace ModestCommands {
const
paramHistory
:
Map
<
string
,
string
>
=
new
Map
();
function
modestExecutable
():
string
|
undefined
{
let
executable
:
string
|
undefined
=
vscode
.
workspace
.
getConfiguration
(
"
modest
"
).
get
(
"
executableLocation
"
);
if
(
executable
===
undefined
||
executable
===
""
)
{
vscode
.
window
.
showErrorMessage
(
"
It looks like you don't have the modest executable located yet.
"
,
"
Go to settings
"
)
.
then
(
result
=>
{
if
(
result
!==
undefined
)
{
vscode
.
commands
.
executeCommand
(
"
workbench.action.openSettings
"
,
"
modest.executableLocation
"
);
}
});
return
;
}
// Surround any directory with whitespace in quotes
return
executable
.
split
(
path
.
sep
).
map
(
value
=>
value
.
match
(
/
\s
/
)
?
`"
${
value
}
"`
:
value
).
join
(
path
.
sep
);
}
export
let
addParameters
=
vscode
.
commands
.
registerCommand
(
'
modest.add-parameters
'
,
async
()
=>
{
provider
.
sendMessage
({
type
:
"
update
"
,
...
...
This diff is collapsed.
Click to expand it.
src/extension.ts
+
70
−
12
View file @
b5eadcf8
...
...
@@ -16,15 +16,50 @@ import {
TransportKind
}
from
'
vscode-languageclient/node
'
;
import
{
ModestCommands
}
from
"
./commands
"
;
import
*
as
path
from
"
path
"
;
import
{
fstat
,
existsSync
}
from
'
fs
'
;
let
client
:
LanguageClient
;
let
client
:
LanguageClient
|
undefined
;
export
let
provider
:
ModestSidebarProvider
;
export
function
activate
(
context
:
ExtensionContext
)
{
export
function
modestExecutable
():
string
|
undefined
{
let
executable
:
string
|
undefined
=
vscode
.
workspace
.
getConfiguration
(
"
modest
"
).
get
(
"
executableLocation
"
);
if
(
executable
===
undefined
||
executable
===
""
)
{
vscode
.
window
.
showErrorMessage
(
"
It looks like you don't have the modest executable located yet.
"
,
"
Go to settings
"
)
.
then
(
result
=>
{
if
(
result
!==
undefined
)
{
vscode
.
commands
.
executeCommand
(
"
workbench.action.openSettings
"
,
"
modest.executableLocation
"
);
}
});
return
;
}
return
executable
;
}
function
createClient
():
LanguageClient
|
undefined
{
// TODO: Check if path exists for a better user experience(so it doesn't spam the user with errors)
// The server is implemented in node
//let serverExe = "D:\\Desktop\\designproject\\modest-toolset\\Binaries\\Release\\win-x64\\Modest.LanguageServer.exe";
let
serverExe
=
"
C:
\\
Users
\\
anoni
\\
Desktop
\\
University projects
\\
module 11
\\
toolset
\\
Binaries
\\
Debug
\\
win-x64
\\
Modest.LanguageServer.exe
"
;
let
serverExe
=
modestExecutable
();
if
(
serverExe
===
undefined
)
{
return
;
}
if
(
!
existsSync
(
serverExe
))
{
vscode
.
window
.
showErrorMessage
(
"
The specified modest executable could not be found
"
,
"
Go to settings
"
)
.
then
(
result
=>
{
if
(
result
!==
undefined
)
{
vscode
.
commands
.
executeCommand
(
"
workbench.action.openSettings
"
,
"
modest.executableLocation
"
);
}
});
return
;
}
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
...
...
@@ -32,12 +67,14 @@ export function activate(context: ExtensionContext) {
// run: { command: serverExe, args: ['-lsp', '-d'] },
run
:
{
command
:
serverExe
,
args
:
[
'
startlspserver
'
],
transport
:
TransportKind
.
stdio
,
},
// debug: { command: serverExe, args: ['-lsp', '-d'] }
debug
:
{
command
:
serverExe
,
command
:
"
dotnet
"
,
transport
:
TransportKind
.
stdio
,
args
:
[
serverExe
.
replace
(
"
.exe
"
,
""
)
+
"
.dll
"
,
'
startlspserver
'
],
// Hacky
runtime
:
""
,
},
};
...
...
@@ -58,23 +95,44 @@ export function activate(context: ExtensionContext) {
//},
};
context
.
subscriptions
.
push
(
ModestCommands
.
simCommand
);
context
.
subscriptions
.
push
(
ModestCommands
.
addParameters
);
// Create the language client and start the client.
client
=
new
LanguageClient
(
const
client
=
new
LanguageClient
(
"
ModestExtension
"
,
"
Modest Extension
"
,
serverOptions
,
clientOptions
);
client
.
registerProposedFeatures
();
client
.
trace
=
Trace
.
Verbose
;
let
langClient
=
client
.
start
();
return
client
;
}
export
function
activate
(
context
:
ExtensionContext
)
{
client
=
createClient
();
if
(
client
)
{
let
langClient
=
client
.
start
();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context
.
subscriptions
.
push
(
langClient
);
}
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context
.
subscriptions
.
push
(
langClient
);
context
.
subscriptions
.
push
(
ModestCommands
.
simCommand
);
context
.
subscriptions
.
push
(
ModestCommands
.
addParameters
);
vscode
.
workspace
.
onDidChangeConfiguration
(
a
=>
{
if
(
a
.
affectsConfiguration
(
"
modest.executableLocation
"
))
{
if
(
client
)
{
client
.
stop
();
client
=
undefined
;
}
client
=
createClient
();
if
(
client
)
{
let
langClient
=
client
.
start
();
context
.
subscriptions
.
push
(
langClient
);
}
}
});
provider
=
new
ModestSidebarProvider
(
context
.
extensionUri
);
...
...
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