Skip to content

Commit 9b3f9aa

Browse files
authored
Merge pull request #67 from CodinGame/fix-invalid-save-file
Fix invalid save file
2 parents ee0728f + ccaa1bd commit 9b3f9aa

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/extensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class FileSystemFeature implements StaticFeature {
9292
}))
9393
disposableCollection.push(getServices().workspace.registerSaveDocumentHandler({
9494
async saveTextContent (document, reason) {
95-
if (languageClientManager.isModelManaged(document)) {
95+
if (languageClientManager.isModelManaged(document) && document.uri.scheme === 'file') {
9696
await infrastructure.saveFileContent?.(document, reason, languageClientManager)
9797
}
9898
}

src/staticOptions.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const staticOptions = asLanguageClientOptionsById({
102102
mutualizable: true
103103
},
104104
cobol: {
105-
documentSelector: ['COBOL'],
105+
documentSelector: [{ scheme: 'file', language: 'COBOL' }],
106106
synchronize: {
107107
configurationSection: 'cobol-lsp'
108108
},
@@ -179,10 +179,12 @@ const staticOptions = asLanguageClientOptionsById({
179179
javascript: {
180180
documentSelector: [
181181
{
182+
scheme: 'file',
182183
pattern: '**/*.{js}',
183184
language: 'javascript'
184185
},
185186
{
187+
scheme: 'file',
186188
pattern: '**/**.{js,jsx}',
187189
language: 'javascript'
188190
}
@@ -214,6 +216,7 @@ const staticOptions = asLanguageClientOptionsById({
214216
},
215217
mysql: {
216218
documentSelector: [{
219+
scheme: 'file',
217220
language: 'sql'
218221
}],
219222
// Disable code actions
@@ -271,6 +274,7 @@ const staticOptions = asLanguageClientOptionsById({
271274
php: {
272275
documentSelector: [
273276
{
277+
scheme: 'file',
274278
pattern: '**/*.php',
275279
language: 'php'
276280
}
@@ -279,6 +283,7 @@ const staticOptions = asLanguageClientOptionsById({
279283
},
280284
postgresql: {
281285
documentSelector: [{
286+
scheme: 'file',
282287
language: 'postgres'
283288
}],
284289
// Disable code actions
@@ -291,7 +296,7 @@ const staticOptions = asLanguageClientOptionsById({
291296
},
292297
python: {
293298
documentSelector: [
294-
{ language: 'python' }
299+
{ scheme: 'file', language: 'python' }
295300
],
296301
synchronize: {
297302
configurationSection: 'python'
@@ -314,6 +319,7 @@ const staticOptions = asLanguageClientOptionsById({
314319
react: {
315320
documentSelector: [
316321
{
322+
scheme: 'file',
317323
pattern: '**/*.{tsx,jsx}'
318324
}
319325
],
@@ -354,6 +360,7 @@ const staticOptions = asLanguageClientOptionsById({
354360
sql: {
355361
documentSelector: [
356362
{
363+
scheme: 'file',
357364
language: 'sql'
358365
}
359366
],
@@ -366,20 +373,14 @@ const staticOptions = asLanguageClientOptionsById({
366373
mutualizable: false
367374
},
368375
swift: {
369-
// https://github.com/apple/sourcekit-lsp/blob/59b5e68f7f8408b5bc44bd47f71ef1afdc63e7a6/Editors/vscode/src/extension.ts#L22
370-
documentSelector: [
371-
'swift',
372-
'cpp',
373-
'c',
374-
'objective-c',
375-
'objective-cpp'
376-
],
376+
documentSelector: [{ scheme: 'file', language: 'swift' }],
377377
synchronize: {},
378378
mutualizable: true
379379
},
380380
typescript: {
381381
documentSelector: [
382382
{
383+
scheme: 'file',
383384
pattern: '**/*.{ts}',
384385
language: 'typescript'
385386
}
@@ -391,6 +392,7 @@ const staticOptions = asLanguageClientOptionsById({
391392
verilog: {
392393
documentSelector: [
393394
{
395+
scheme: 'file',
394396
language: 'verilog'
395397
}
396398
],
@@ -400,6 +402,7 @@ const staticOptions = asLanguageClientOptionsById({
400402
vue: {
401403
documentSelector: [
402404
{
405+
scheme: 'file',
403406
pattern: '**/*.js',
404407
language: 'javascript'
405408
}

0 commit comments

Comments
 (0)