@@ -183,7 +183,7 @@ void LanguageServer::changeConfiguration(Json::Value const& _settings)
183
183
else if (text == " directly-opened-and-on-import" )
184
184
m_fileLoadStrategy = FileLoadStrategy::DirectlyOpenedAndOnImported;
185
185
else
186
- lspAssert (false , ErrorCode::InvalidParams, " Invalid file load strategy: " + text);
186
+ lspRequire (false , ErrorCode::InvalidParams, " Invalid file load strategy: " + text);
187
187
}
188
188
189
189
m_settingsObject = _settings;
@@ -366,7 +366,7 @@ bool LanguageServer::run()
366
366
367
367
void LanguageServer::requireServerInitialized ()
368
368
{
369
- lspAssert (
369
+ lspRequire (
370
370
m_state == State::Initialized,
371
371
ErrorCode::ServerNotInitialized,
372
372
" Server is not properly initialized."
@@ -375,7 +375,7 @@ void LanguageServer::requireServerInitialized()
375
375
376
376
void LanguageServer::handleInitialize (MessageID _id, Json::Value const & _args)
377
377
{
378
- lspAssert (
378
+ lspRequire (
379
379
m_state == State::Started,
380
380
ErrorCode::RequestFailed,
381
381
" Initialize called at the wrong time."
@@ -389,7 +389,7 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
389
389
if (Json::Value uri = _args[" rootUri" ])
390
390
{
391
391
rootPath = uri.asString ();
392
- lspAssert (
392
+ lspRequire (
393
393
boost::starts_with (rootPath, " file://" ),
394
394
ErrorCode::InvalidParams,
395
395
" rootUri only supports file URI scheme."
@@ -471,7 +471,7 @@ void LanguageServer::handleTextDocumentDidOpen(Json::Value const& _args)
471
471
{
472
472
requireServerInitialized ();
473
473
474
- lspAssert (
474
+ lspRequire (
475
475
_args[" textDocument" ],
476
476
ErrorCode::RequestFailed,
477
477
" Text document parameter missing."
@@ -492,14 +492,14 @@ void LanguageServer::handleTextDocumentDidChange(Json::Value const& _args)
492
492
493
493
for (Json::Value jsonContentChange: _args[" contentChanges" ])
494
494
{
495
- lspAssert (
495
+ lspRequire (
496
496
jsonContentChange.isObject (),
497
497
ErrorCode::RequestFailed,
498
498
" Invalid content reference."
499
499
);
500
500
501
501
string const sourceUnitName = m_fileRepository.uriToSourceUnitName (uri);
502
- lspAssert (
502
+ lspRequire (
503
503
m_fileRepository.sourceUnits ().count (sourceUnitName),
504
504
ErrorCode::RequestFailed,
505
505
" Unknown file: " + uri
@@ -509,7 +509,7 @@ void LanguageServer::handleTextDocumentDidChange(Json::Value const& _args)
509
509
if (jsonContentChange[" range" ].isObject ()) // otherwise full content update
510
510
{
511
511
optional<SourceLocation> change = parseRange (m_fileRepository, sourceUnitName, jsonContentChange[" range" ]);
512
- lspAssert (
512
+ lspRequire (
513
513
change && change->hasText (),
514
514
ErrorCode::RequestFailed,
515
515
" Invalid source range: " + util::jsonCompactPrint (jsonContentChange[" range" ])
@@ -529,7 +529,7 @@ void LanguageServer::handleTextDocumentDidClose(Json::Value const& _args)
529
529
{
530
530
requireServerInitialized ();
531
531
532
- lspAssert (
532
+ lspRequire (
533
533
_args[" textDocument" ],
534
534
ErrorCode::RequestFailed,
535
535
" Text document parameter missing."
0 commit comments