-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add completion for Yocto tasks in embedded languages
- Loading branch information
1 parent
5fa36d2
commit ac882ac
Showing
5 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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,26 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2023 Savoir-faire Linux. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
|
||
export const mergeArraysDistinctly = <ElementType, KeyType>( | ||
array1: ElementType[], | ||
array2: ElementType[], | ||
getKey: (a: ElementType) => KeyType // A key on which two elements are equal | ||
): ElementType[] => { | ||
const mergedArray: ElementType[] = [] | ||
const seenKeys = new Set<KeyType>() | ||
|
||
array1.forEach((item) => { | ||
mergedArray.push(item) | ||
seenKeys.add(getKey(item)) | ||
}) | ||
|
||
array2.forEach((item) => { | ||
if (!seenKeys.has(getKey(item))) { | ||
mergedArray.push(item) | ||
} | ||
}) | ||
|
||
return mergedArray | ||
} |
4 changes: 2 additions & 2 deletions
4
integration-tests/project-folder/sources/meta-fixtures/completion.bb
This file contains 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
python do_foo(){ | ||
pri | ||
p | ||
} | ||
|
||
do_bar(){ | ||
ech | ||
e | ||
} | ||
|
||
DESCRIP |
This file contains 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 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