C/C++ plugin - added file support
This commit is contained in:
parent
e480135055
commit
262d26869c
6 changed files with 75 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "com.gregorybednov"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
|||
25
src/main/kotlin/org/gregorybednov/NewCFileAction.kt
Normal file
25
src/main/kotlin/org/gregorybednov/NewCFileAction.kt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package org.gregorybednov
|
||||
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateAction
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateDialog
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiDirectory
|
||||
import org.gregorybednov.clsp.CIcon
|
||||
|
||||
|
||||
class NewCFileAction :
|
||||
CreateFileFromTemplateAction("C File", "Creates new C file", CIcon.FILE ) {
|
||||
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) {
|
||||
builder
|
||||
.setTitle("New C File")
|
||||
.addKind("My file", CIcon.FILE, "DefaultTemplate.c")
|
||||
}
|
||||
|
||||
override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String {
|
||||
return "C File"
|
||||
}
|
||||
|
||||
override fun getDefaultTemplateProperty(): String {
|
||||
return "DefaultTemplate.c";
|
||||
}
|
||||
}
|
||||
26
src/main/kotlin/org/gregorybednov/NewCppFileAction.kt
Normal file
26
src/main/kotlin/org/gregorybednov/NewCppFileAction.kt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package org.gregorybednov
|
||||
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateAction
|
||||
import com.intellij.ide.actions.CreateFileFromTemplateDialog
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiDirectory
|
||||
import org.gregorybednov.clsp.CIcon
|
||||
import org.gregorybednov.clsp.CppIcon
|
||||
|
||||
|
||||
class NewCppFileAction :
|
||||
CreateFileFromTemplateAction("C++ File", "Creates new C++ file", CppIcon.FILE ) {
|
||||
override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) {
|
||||
builder
|
||||
.setTitle("New C++ File")
|
||||
.addKind("My file", CIcon.FILE, "DefaultTemplate.cpp")
|
||||
}
|
||||
|
||||
override fun getActionName(directory: PsiDirectory?, newName: String, templateName: String?): String {
|
||||
return "C++ File"
|
||||
}
|
||||
|
||||
override fun getDefaultTemplateProperty(): String {
|
||||
return "DefaultTemplate.cpp";
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,18 @@
|
|||
<depends>com.redhat.devtools.lsp4ij</depends>
|
||||
<depends>org.jetbrains.plugins.textmate</depends>
|
||||
|
||||
<actions>
|
||||
<action id="NewCFileAction" class="org.gregorybednov.NewCFileAction" >
|
||||
<add-to-group group-id="NewGroup" relative-to-action="NewFile" anchor="before"/>
|
||||
</action>
|
||||
<action id="NewCppFileAction" class="org.gregorybednov.NewCppFileAction">
|
||||
<add-to-group group-id="NewGroup" relative-to-action="NewFile" anchor="before"/>
|
||||
</action>
|
||||
</actions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<internalFileTemplate name="DefaultTemplate.c"/>
|
||||
<internalFileTemplate name="DefaultTemplate.cpp"/>
|
||||
<notificationGroup id="C/C++ notifications"
|
||||
displayType="BALLOON" />
|
||||
<fileType
|
||||
|
|
@ -20,7 +31,6 @@
|
|||
fieldName="INSTANCE"
|
||||
implementationClass="org.gregorybednov.clsp.CFileType"/>
|
||||
|
||||
<!-- F*** $YourFileLanguage!!!!! I spent f**ing week trying to understand what's wrong!!!-->
|
||||
<editorHighlighterProvider
|
||||
filetype="C File"
|
||||
implementationClass="org.jetbrains.plugins.textmate.language.syntax.highlighting.TextMateEditorHighlighterProvider" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
\#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
\#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello world";
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue