Skip to content

Commit

Permalink
Add .resource extension to Robot Framework (#6500)
Browse files Browse the repository at this point in the history
* add .resource extension to robot

* add resource file example

* docs

* add heuristics for RF resource files

* fix typo

* add robotframework keywords heuristic

---------

Co-authored-by: Colin Seymour <[email protected]>
  • Loading branch information
Noordsestern and lildude authored Aug 31, 2024
1 parent ebbedf0 commit 15e5607
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/linguist/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extensions:
- ".9"
- ".app"
- ".cmp"
- ".resource"
- ".sol"
- ".stl"
- ".tag"
Expand Down
5 changes: 5 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ disambiguations:
pattern:
- '^\s*(let|module|type)\s+\w*\s+=\s+'
- '^\s*(?:include|open)\s+\w+\s*$'
- extensions: ['.resource']
rules:
- language: RobotFramework
pattern:
- '^\*{3} (Settings|Variables|Keywords) \*{3}$'
- extensions: ['.rno']
rules:
- language: RUNOFF
Expand Down
1 change: 1 addition & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6207,6 +6207,7 @@ RobotFramework:
color: "#00c0b5"
extensions:
- ".robot"
- ".resource"
tm_scope: text.robot
ace_mode: text
language_id: 324
Expand Down
21 changes: 21 additions & 0 deletions samples/RobotFramework/keywords.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*** Settings ***
Documentation Example keywords file.
... It is recommended to use another ending than `.robot` for resource files.
... By convention, the file ending for resource files is `.resource`.
... Another resource than `.robot` makes maintaining large projects easier. It also prevents
... the parser to search for tasks or test cases in resource files, which saves some startup performance.
Library Collections


*** Variables ***
${variable} ${EMPTY}
${some_list} @{EMPTY}
${some_dict} &{EMPTY}


*** Keywords ***
Dictionary Should Contain ${key}=${value}

This comment was marked as spam.

Copy link
@WEI567

WEI567 Nov 25, 2024

i’m just saying

[Arguments] ${dict}
Dictionary Should Contain Key ${dict} ${key}
Should Be Equal ${dict}[key] ${value} msg=Dictionary does not hold expected item.
6 changes: 6 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,12 @@ def test_res_by_heuristics
})
end

def test_resource_by_heuristics
assert_heuristics({
"RobotFramework" => all_fixtures("RobotFramework", "*.resource")
})
end

def test_rno_by_heuristics
assert_heuristics({
"RUNOFF" => all_fixtures("RUNOFF", "*.rno"),
Expand Down

0 comments on commit 15e5607

Please sign in to comment.