-
Notifications
You must be signed in to change notification settings - Fork 112
Feature/os class module type #3113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nixel2007
wants to merge
23
commits into
develop
Choose a base branch
from
feature/osClassModuleType
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8b88ec9
Свой ModuleType
asosnoviy 1f4f4eb
Тип в VariableSymbol
asosnoviy 7b9fbaf
Ховер типа переменной
asosnoviy f1c47cc
TypeName в документКонтекст
asosnoviy 906a841
Переход к модулю класса
asosnoviy 3256a32
Переход к модулю
asosnoviy 8254cfa
npe fix
asosnoviy 0196b26
Игры с кириличискими путями
asosnoviy aea805f
bump libraries
theshadowco c5b8dd5
Merge remote-tracking branch 'origin/develop' into feature/osClassMod…
theshadowco 9483ffc
микрофиксы
theshadowco 4058a27
Merge remote-tracking branch 'origin/develop' into feature/osClassMod…
asosnoviy c12af1d
Заглушка на неожиданный null
asosnoviy 5e33760
не знаю что это
asosnoviy 7992f30
rebase и восстановил работоспособность костылем
theshadowco fee008e
Откат ошибок ребейза
nixel2007 fdff4f1
Вынес логику работы с DocumentState в публичный интерфейс, рефакторин…
nixel2007 2d30dca
Merge branch 'develop' into feature/osClassModuleType
nixel2007 d69dde6
TODO + License
nixel2007 863d672
Уточнен состав референса для модулей и классов оскрипта
nixel2007 f51c2f0
Merge branch 'develop' into feature/osClassModuleType
nixel2007 040cd86
Happy new year
nixel2007 137731f
Merge branch 'develop' into feature/osClassModuleType
nixel2007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...in/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ModuleTypeComputer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* This file is a part of BSL Language Server. | ||
* | ||
* Copyright (c) 2018-2023 | ||
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Fedkin <nixel2007@gmail.com> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Language Server is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* BSL Language Server is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with BSL Language Server. | ||
*/ | ||
package com.github._1c_syntax.bsl.languageserver.context.computer; | ||
|
||
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext; | ||
import com.github._1c_syntax.bsl.languageserver.context.FileType; | ||
import com.github._1c_syntax.bsl.types.ModuleType; | ||
|
||
import java.nio.file.Path; | ||
|
||
public class ModuleTypeComputer { | ||
|
||
private final DocumentContext documentContext; | ||
|
||
public ModuleTypeComputer(DocumentContext documentContext) { | ||
this.documentContext = documentContext; | ||
} | ||
|
||
public ModuleType computeModuleType() { | ||
|
||
ModuleType moduleType; | ||
if (documentContext.getFileType() == FileType.BSL) { | ||
moduleType = computeBSL(); | ||
} else if (documentContext.getFileType() == FileType.OS) { | ||
moduleType = computeOS(); | ||
} else { | ||
moduleType = ModuleType.UNKNOWN; | ||
} | ||
|
||
return moduleType; | ||
} | ||
|
||
private ModuleType computeBSL() { | ||
var type = documentContext.getServerContext() | ||
.getConfiguration().getModuleTypeByURI(documentContext.getUri()); | ||
return ModuleType.valueOf(type.name()); | ||
} | ||
|
||
private ModuleType computeOS() { | ||
if (documentContext.getUri().getPath().contains("Модули")) { | ||
return ModuleType.OScriptModule; | ||
} else if (documentContext.getUri().getPath().contains("Классы")) { | ||
Comment on lines
+59
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Думаю, стоит завести список имен, которые будут идентифицироваться как классы\модули. Например англоязычные названия, каталог с командами для приложения или иное. Можно попробовать отдельно читать конфиг библиотеки, при его наличии |
||
return ModuleType.OScriptClass; | ||
} else { | ||
return ModuleType.UNKNOWN; | ||
} | ||
} | ||
|
||
public String computeTypeName() { | ||
if (documentContext.getModuleType() == ModuleType.OScriptModule | ||
|| documentContext.getModuleType() == ModuleType.OScriptClass) { | ||
return Path.of(documentContext.getUri()).getFileName().toString().replace(".os", ""); | ||
} | ||
return ""; | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.