Skip to content

Commit 7ef83f3

Browse files
committed
1 parent 1eff140 commit 7ef83f3

File tree

12 files changed

+690
-149
lines changed

12 files changed

+690
-149
lines changed

Diff for: icons/robot.woff

-1.48 KB
Binary file not shown.

Diff for: icons/robotcode.woff2

2.02 KB
Binary file not shown.

Diff for: package.json

+54-4
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,37 @@
8686
"robotcode-robot": {
8787
"description": "RobotFramework Icon",
8888
"default": {
89-
"fontPath": "./icons/robot.woff",
89+
"fontPath": "./icons/robotcode.woff2",
9090
"fontCharacter": "\\E900"
9191
}
92+
},
93+
"robotcode-robocop": {
94+
"description": "RoboCop Icon",
95+
"default": {
96+
"fontPath": "./icons/robotcode.woff2",
97+
"fontCharacter": "\\E901"
98+
}
99+
},
100+
"robotcode-python": {
101+
"description": "Python Icon",
102+
"default": {
103+
"fontPath": "./icons/robotcode.woff2",
104+
"fontCharacter": "\\E902"
105+
}
106+
},
107+
"robotcode-tidy": {
108+
"description": "Python Icon",
109+
"default": {
110+
"fontPath": "./icons/robotcode.woff2",
111+
"fontCharacter": "\\E903"
112+
}
113+
},
114+
"robotcode-robotcode": {
115+
"description": "Python Icon",
116+
"default": {
117+
"fontPath": "./icons/robotcode.woff2",
118+
"fontCharacter": "\\E904"
119+
}
92120
}
93121
},
94122
"views": {
@@ -920,21 +948,38 @@
920948
"title": "Run Current File",
921949
"category": "RobotCode",
922950
"command": "robotcode.runCurrentFile",
923-
"enablement": "resourceLangId == robotframework && resourceExtname == .robot || explorerResourceIsFolder",
951+
"enablement": "resourceLangId == robotframework && resourceExtname == .robot",
924952
"icon": "$(run)"
925953
},
926954
{
927955
"title": "Debug Current File",
928956
"category": "RobotCode",
929957
"command": "robotcode.debugCurrentFile",
930-
"enablement": "resourceLangId == robotframework && resourceExtname == .robot || explorerResourceIsFolder",
958+
"enablement": "resourceLangId == robotframework && resourceExtname == .robot",
931959
"icon": "$(debug-alt)"
932960
},
933961
{
934962
"title": "Restart Language Servers",
935963
"category": "RobotCode",
936964
"command": "robotcode.restartLanguageServers"
937965
},
966+
{
967+
"title": "Disable RoboCop",
968+
"category": "RobotCode",
969+
"command": "robotcode.disableRoboCop",
970+
"enablement": "resourceLangId == robotframework && config.robotcode.robocop.enabled"
971+
},
972+
{
973+
"title": "Enable RoboCop",
974+
"category": "RobotCode",
975+
"command": "robotcode.enableRoboCop",
976+
"enablement": "resourceLangId == robotframework && !config.robotcode.robocop.enabled"
977+
},
978+
{
979+
"title": "Report Issue...",
980+
"category": "RobotCode",
981+
"command": "robotcode.reportIssue"
982+
},
938983
{
939984
"title": "Clear Cache and Restart Language Servers",
940985
"category": "RobotCode",
@@ -945,6 +990,11 @@
945990
"category": "RobotCode",
946991
"command": "robotcode.selectConfigurationProfiles"
947992
},
993+
{
994+
"title": "Show Tool Menu",
995+
"category": "RobotCode",
996+
"command": "robotcode.showToolMenu"
997+
},
948998
{
949999
"title": "Refresh",
9501000
"command": "robotcode.keywordsTreeView.refresh",
@@ -1547,4 +1597,4 @@
15471597
"workspaces": [
15481598
"docs"
15491599
]
1550-
}
1600+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from dataclasses import dataclass
2+
from typing import TYPE_CHECKING, Any, Optional
3+
4+
from robot.version import get_version
5+
6+
from robotcode.core.utils.dataclasses import CamelSnakeMixin
7+
from robotcode.core.utils.logging import LoggingDescriptor
8+
from robotcode.jsonrpc2.protocol import rpc_method
9+
10+
from .formatting import robotidy_installed
11+
from .protocol_part import RobotLanguageServerProtocolPart
12+
from .robocop_diagnostics import robocop_installed
13+
14+
if TYPE_CHECKING:
15+
from ..protocol import RobotLanguageServerProtocol
16+
17+
18+
@dataclass(repr=False)
19+
class ProjectInfo(CamelSnakeMixin):
20+
robot_version_string: str
21+
robocop_version_string: Optional[str]
22+
tidy_version_string: Optional[str] = None
23+
24+
25+
class ProjectInfoPart(RobotLanguageServerProtocolPart):
26+
_logger = LoggingDescriptor()
27+
28+
def __init__(self, parent: "RobotLanguageServerProtocol") -> None:
29+
super().__init__(parent)
30+
31+
@rpc_method(name="robot/projectInfo", threaded=True)
32+
@_logger.call
33+
def _get_document_imports(
34+
self,
35+
*args: Any,
36+
**kwargs: Any,
37+
) -> ProjectInfo:
38+
robocop_version_string = None
39+
if robocop_installed():
40+
from robocop.version import __version__
41+
42+
robocop_version_string = __version__
43+
44+
tidy_version_string = None
45+
if robotidy_installed():
46+
from robotidy.version import __version__
47+
48+
tidy_version_string = __version__
49+
50+
return ProjectInfo(
51+
robot_version_string=get_version(),
52+
robocop_version_string=robocop_version_string,
53+
tidy_version_string=tidy_version_string,
54+
)

Diff for: packages/language_server/src/robotcode/language_server/robotframework/protocol.py

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from .parts.inlay_hint import RobotInlayHintProtocolPart
4444
from .parts.inline_value import RobotInlineValueProtocolPart
4545
from .parts.keywords_treeview import RobotKeywordsTreeViewPart
46+
from .parts.project_info import ProjectInfoPart
4647
from .parts.references import RobotReferencesProtocolPart
4748
from .parts.rename import RobotRenameProtocolPart
4849
from .parts.robocop_diagnostics import RobotRoboCopDiagnosticsProtocolPart
@@ -116,6 +117,7 @@ class RobotLanguageServerProtocol(LanguageServerProtocol):
116117

117118
robot_debugging_utils = ProtocolPartDescriptor(RobotDebuggingUtilsProtocolPart)
118119
robot_keywords_treeview = ProtocolPartDescriptor(RobotKeywordsTreeViewPart)
120+
robot_project_info = ProtocolPartDescriptor(ProjectInfoPart)
119121

120122
http_server = ProtocolPartDescriptor(HttpServerProtocolPart)
121123

Diff for: packages/runner/src/robotcode/runner/cli/discover/discover.py

-2
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,6 @@ def info(app: Application) -> None:
912912
if app.config.output_format is None or app.config.output_format == OutputFormat.TEXT:
913913
for key, value in as_dict(info, remove_defaults=True).items():
914914
app.echo_via_pager(f"{key}: {value}")
915-
916-
# app.print_data(info, remove_defaults=True)
917915
else:
918916
app.print_data(info, remove_defaults=True)
919917

Diff for: vscode-client/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
export const CONFIG_SECTION = "robotcode";
2+
export const CONFIG_ROBOCOP_ENABLED = "robocop.enabled";
3+
export const CONFIG_ANALYSIS_DIAGNOSTICMODE = "analysis.diagnosticMode";
4+
export const CONFIG_ANALYSIS_DIAGNOSTICMODE_OPENFILESONLY = "openFilesOnly";
5+
export const CONFIG_ANALYSIS_DIAGNOSTICMODE_WORKSPACE = "workspace";
6+
export const CONFIG_PROFILES = "profiles";

Diff for: vscode-client/extension.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LanguageClientsManager } from "./languageclientsmanger";
44
import { PythonManager } from "./pythonmanger";
55
import { TestControllerManager } from "./testcontrollermanager";
66
import { KeywordsTreeViewProvider } from "./keywordsTreeViewProvider";
7+
import { LanguageToolsManager } from "./languageToolsManager";
78

89
class TerminalLink extends vscode.TerminalLink {
910
constructor(
@@ -48,6 +49,7 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
4849
languageClientManger,
4950
debugManager,
5051
testControllerManger,
52+
new LanguageToolsManager(context, languageClientManger, pythonManager, testControllerManger, outputChannel),
5153
vscode.commands.registerCommand("robotcode.showDocumentation", async (url: string) => {
5254
if (url.indexOf("&theme=%24%7Btheme%7D") > 0) {
5355
url = url.replace("%24%7Btheme%7D", getDocTheme());
@@ -115,17 +117,7 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
115117
}),
116118

117119
new KeywordsTreeViewProvider(context, languageClientManger, outputChannel),
118-
);
119120

120-
context.environmentVariableCollection.clear();
121-
context.environmentVariableCollection.description = new vscode.MarkdownString(
122-
"Disable ANSI links in `robot`'s terminal output.",
123-
);
124-
context.environmentVariableCollection.replace("ROBOTCODE_DISABLE_ANSI_LINKS", "1");
125-
126-
await languageClientManger.refresh();
127-
128-
context.subscriptions.push(
129121
vscode.workspace.onDidChangeConfiguration(async (event) => {
130122
const affectedFolders = new Set<vscode.Uri>();
131123

@@ -156,6 +148,15 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
156148
}
157149
}),
158150
);
151+
152+
context.environmentVariableCollection.clear();
153+
context.environmentVariableCollection.description = new vscode.MarkdownString(
154+
"Disable ANSI links in `robot`'s terminal output.",
155+
);
156+
157+
context.environmentVariableCollection.replace("ROBOTCODE_DISABLE_ANSI_LINKS", "1");
158+
159+
languageClientManger.refresh();
159160
}
160161

161162
function displayProgress<R>(promise: Promise<R>): Thenable<R> {

0 commit comments

Comments
 (0)