Skip to content

Commit

Permalink
Add introduction section
Browse files Browse the repository at this point in the history
  • Loading branch information
tiginamaria committed Jan 16, 2024
1 parent 3f82b84 commit 4705e75
Show file tree
Hide file tree
Showing 64 changed files with 108 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ In the `.github/workflows` directory, you can find definitions for the following
[file:gradle.properties]: ./gradle.properties
[file:course-info.yaml]: ./course-info.yaml
[file:courseignore]: .courseignore
[file:course.lesson.tests]: courseSection/psi/programmingTask/test/Tests.kt
[file:course.framework.lesson.tests]: ./courseSection/courseFrameworkLesson/programmingTask/test/Tests.kt
[file:course.lesson.tests]: psiSection/psi/programmingTask/test/Tests.kt
[file:course.framework.lesson.tests]: psiSection/courseFrameworkLesson/programmingTask/test/Tests.kt

[gradle]: https://gradle.org

Expand Down
3 changes: 2 additions & 1 deletion course-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ language: English
summary: TODO
programming_language: Kotlin
content:
- courseSection
- introductionSection
- psiSection
environment_settings:
jvm_language_level: JDK_17
3 changes: 3 additions & 0 deletions introductionSection/section-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
custom_name: Introduction
content:
- welcomeLesson
1 change: 1 addition & 0 deletions introductionSection/section-remote-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: 459294228
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jetbrains.academy.plugin.course.dev.welcome

fun sayHelloHelena(howManyTimes: Int): String {
TODO()
}

fun main() {
val howManyTimes = readln().toInt()
print(sayHelloHelena(howManyTimes))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: edu
custom_name: Hello Helena!
files:
- name: src/main/kotlin/org/jetbrains/academy/plugin/course/dev/welcome/HelloHelena.kt
visible: true
- name: test/org/jetbrains/academy/plugin/course/dev/welcome/Tests.kt
visible: false
10 changes: 10 additions & 0 deletions introductionSection/welcomeLesson/helloHelenaTask/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Hi! My name is Helena. I’m working in the Plugin Development Team. We have just hired a new young developer, Jonsi, so I’ve prepared lots of amazing projects for him to do.

But wait, he has never worked with IntelliJ Platform before?! So well, I’ll try to teach him all important things during one week of his probation.

Say hello to Helena! Add implementation to method `helloHelena` method which should return “Hello, Helena!” given number of times, separated by new line.

<div class="hint">

Use `System.lineSeparator()` to get platform specific new line symbol
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.jetbrains.academy.plugin.course.dev.welcome


import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
class Test(private val howManyTimes: Int) {

private fun expectedSayHelloHelena(howManyTimes: Int): String {
return List(howManyTimes) { "Hello, Helena!" }.joinToString(System.lineSeparator())
}

@Test
fun test() {
assertEquals(expectedSayHelloHelena(howManyTimes), sayHelloHelena(howManyTimes))
}

companion object {
@JvmStatic
@Parameterized.Parameters
fun data(): List<Int> {
return listOf(1, 5, 10, 100)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jetbrains.academy.plugin.course.dev.welcome

fun sayHelloJonsi(howManyTimes: Int): String {
return List(howManyTimes) { "Hello, Jonsi!" }.joinToString(System.lineSeparator())
}

fun main() {
val howManyTimes = readln().toInt()
print(sayHelloJonsi(howManyTimes))
}
12 changes: 12 additions & 0 deletions introductionSection/welcomeLesson/helpJonsiTask/task-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: choice
custom_name: Ready to Help Jonsi?
is_multiple_choice: false
options:
- text: "yes"
is_correct: true
- text: "no"
is_correct: false
files:
- name: src/main/kotlin/org/jetbrains/academy/plugin/course/dev/welcome/HelloJonsi.kt
visible: true
local_check: true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: 853483765
5 changes: 5 additions & 0 deletions introductionSection/welcomeLesson/helpJonsiTask/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Hi! My name is Jonsi! It’s my first day at JetBrains, and I’m ready to start! But I’m really nervous of my probation week as I have no idea, how IDE works behind and what is more, how to write plugins for it.

So I really need someone's help!!!

Maybe you can help me?
4 changes: 4 additions & 0 deletions introductionSection/welcomeLesson/lesson-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
custom_name: Welcome and good luck!
content:
- helloHelenaTask
- helpJonsiTask
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: 853483765
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ As you probably read there, PSI represents the entire structure of the code in a
called a PSI tree.

### PSI Tree Structure
* The root is a [`PSI File`](https://plugins.jetbrains.com/docs/intellij/psi-files.html) element, representing an entire file.
* The root is a [`PSI File`](https://plugins.jetbrains.com/docs/intellij/psi-files.html) element, representing an entire file
* Each node or [`PSI Element`](https://plugins.jetbrains.com/docs/intellij/psi-elements.html) in the tree represents a syntactic or structural part of the code, like expressions,
* statements, and declarations.
statements, and declarations

### Types of PSI Elements
* PsiFile: Represents an entire file.
* PsiClass: Represents a class in the code.
* PsiMethod: Represents a method.
* PsiVariable: Represents a variable.
* PsiExpression: Represents an expression, and so on.
* PsiFile: Represents an entire file
* PsiClass: Represents a class in the code
* PsiMethod: Represents a method
* PsiVariable: Represents a variable
* PsiExpression: Represents an expression, and so on

Each language (Java/Kotlin/Python) has their own implementations of [`PsiElement`](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java),
Each language (Java, Kotlin, Python, etc.) has their own implementations of [`PsiElement`](https://github.com/JetBrains/intellij-community/blob/master/platform/core-api/src/com/intellij/psi/PsiElement.java),
so for example for file abstraction there are following options:
* [`com.intellij.psi.PsiFile`](https://github.com/JetBrains/intellij-community/blob/idea/232.10227.8/platform/core-api/src/com/intellij/psi/PsiFile.java): Represents an Java file.
* [`org.jetbrains.kotlin.psi.KtFile`](https://github.com/JetBrains/kotlin/blob/master/compiler/psi/src/org/jetbrains/kotlin/psi/KtFile.kt): Represents a Kotlin file.
* [`com.jetbrains.python.psi.PyFile`](https://github.com/JetBrains/intellij-community/blob/master/python/python-psi-api/src/com/jetbrains/python/psi/PyFile.java#L28): Represents a Python file.
* [`com.intellij.psi.PsiFile`](https://github.com/JetBrains/intellij-community/blob/idea/232.10227.8/platform/core-api/src/com/intellij/psi/PsiFile.java): Represents an Java file
* [`org.jetbrains.kotlin.psi.KtFile`](https://github.com/JetBrains/kotlin/blob/master/compiler/psi/src/org/jetbrains/kotlin/psi/KtFile.kt): Represents a Kotlin file
* [`com.jetbrains.python.psi.PyFile`](https://github.com/JetBrains/intellij-community/blob/master/python/python-psi-api/src/com/jetbrains/python/psi/PyFile.java#L28): Represents a Python file

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: choice
custom_name: Try PS Viewer
custom_name: Try PSI Viewer
is_multiple_choice: true
options:
- text: org.jetbrains.kotlin.psi.KtClass
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4705e75

Please sign in to comment.