本文整理汇总了Java中com.intellij.lang.javascript.JavaScriptFileType类的典型用法代码示例。如果您正苦于以下问题:Java JavaScriptFileType类的具体用法?Java JavaScriptFileType怎么用?Java JavaScriptFileType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaScriptFileType类属于com.intellij.lang.javascript包,在下文中一共展示了JavaScriptFileType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetSnippetNamespaceFromFile
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
/**
* @see ExtJsUtil#getSnippetNamespaceFromFile
*/
public void testGetSnippetNamespaceFromFile() {
String[] foo = {
"//{namespace name=backend/index/view/widgets}",
"//{namespace name = backend/index/view/widgets}",
"//{namespace foobar='aaaa' name='backend/index/view/widgets' }",
"//{namespace name=\"backend/index/view/widgets\" }",
};
for (String s : foo) {
PsiFile fileFromText = PsiFileFactory.getInstance(getProject())
.createFileFromText("foo.js", JavaScriptFileType.INSTANCE, s);
assertEquals("backend/index/view/widgets", ExtJsUtil.getSnippetNamespaceFromFile(fileFromText));
}
}
示例2: setupSdkPaths
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
@Override
public void setupSdkPaths(Sdk sdk)
{
SdkModificator modificator = sdk.getSdkModificator();
VirtualFile stubsDirectory = LocalFileSystem.getInstance().findFileByIoFile(new File(PluginManager.getPluginPath(NodeJSBundleType.class), "stubs"));
if(stubsDirectory != null)
{
for(VirtualFile file : stubsDirectory.getChildren())
{
if(file.getFileType() == JavaScriptFileType.INSTANCE)
{
modificator.addRoot(file, BinariesOrderRootType.getInstance());
modificator.addRoot(file, SourcesOrderRootType.getInstance());
}
}
}
modificator.commitChanges();
}
示例3: findExecutableFile
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
@Nullable
public static VirtualFile findExecutableFile(ConfigurationContext configurationContext, @Nullable Condition<JSFile> condition)
{
PsiElement psiLocation = configurationContext.getPsiLocation();
PsiFile psiFile = psiLocation == null ? null : psiLocation.getContainingFile();
if(psiFile instanceof JSFile && psiFile.getFileType() == JavaScriptFileType.INSTANCE)
{
if(condition != null && !condition.value((JSFile) psiFile))
{
return null;
}
Module module = configurationContext.getModule();
if(module == null)
{
return null;
}
NodeJSModuleExtension extension = ModuleUtilCore.getExtension(module, NodeJSModuleExtension.class);
if(extension == null)
{
return null;
}
return psiFile.getVirtualFile();
}
return null;
}
示例4: apply
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
@Override
public void apply(CodeStyleSettings settings) {
CommonCodeStyleSettings commonSettings = settings.getCommonSettings(getLanguage());
commonSettings.SPACE_WITHIN_PARENTHESES = true;
commonSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true;
commonSettings.SPACE_WITHIN_METHOD_PARENTHESES = true;
commonSettings.SPACE_WITHIN_IF_PARENTHESES = true;
commonSettings.SPACE_WITHIN_WHILE_PARENTHESES = true;
commonSettings.SPACE_WITHIN_FOR_PARENTHESES = true;
commonSettings.SPACE_WITHIN_CATCH_PARENTHESES = true;
commonSettings.SPACE_WITHIN_SWITCH_PARENTHESES = true;
commonSettings.SPACE_WITHIN_ARRAY_INITIALIZER_BRACES = true;
commonSettings.SPACE_AFTER_TYPE_CAST = true;
CodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(JavaScriptFileType.INSTANCE);
indentOptions.USE_TAB_CHARACTER = true;
indentOptions.SMART_TABS = true;
indentOptions.TAB_SIZE = 4;
indentOptions.INDENT_SIZE = 4;
indentOptions.CONTINUATION_INDENT_SIZE = 4;
indentOptions.LABEL_INDENT_SIZE = 0;
indentOptions.LABEL_INDENT_ABSOLUTE = false;
indentOptions.USE_RELATIVE_INDENTS = false;
}
示例5: JavaScriptLineBreakpointType
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public JavaScriptLineBreakpointType()
{
super("javascript", "JavaScript Breakpoints", new XDebuggerEditorsProvider()
{
@NotNull
@Override
public FileType getFileType()
{
return JavaScriptFileType.INSTANCE;
}
@NotNull
@Override
public Document createDocument(@NotNull Project project, @NotNull String s, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode evaluationMode)
{
return JSDebuggerSupportUtils.createDocument(s, project, sourcePosition == null ? null : sourcePosition.getFile(), sourcePosition == null ? 0 : sourcePosition.getOffset());
}
});
}
示例6: isGraphQLRelatedFile
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
protected boolean isGraphQLRelatedFile(VirtualFile file) {
if(file.getFileType() == JSGraphQLFileType.INSTANCE) {
return true;
}
if(JavaScriptFileType.getFileTypesCompilableToJavaScript().contains(file.getFileType())) {
return true;
}
return false;
}
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:10,代码来源:JSGraphQLNodeInterpreterEditorNotificationProvider.java
示例7: getInputFilter
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
return file -> {
FileType fileType = file.getFileType();
return fileType == SmartyFileType.INSTANCE || fileType == JavaScriptFileType.INSTANCE || "ini".equalsIgnoreCase(file.getExtension());
};
}
示例8: testCompletionPrefixForSnippetNameWithFileScopeNamespace
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testCompletionPrefixForSnippetNameWithFileScopeNamespace() {
String[] dataProvider = {
"{s name='<caret>'}",
"{s name=<caret>}",
};
for (String s : dataProvider) {
assertCompletionContains(
JavaScriptFileType.INSTANCE,
"//{namespace name=foobar/widgets}\n" +
"var foo = {foo: \"" + s + "\"}",
"swag-last-registrations/customer"
);
}
}
示例9: testCompletionPrefixForSnippetNameWithInlineNamespace
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testCompletionPrefixForSnippetNameWithInlineNamespace() {
String[] dataProvider = {
"{s name='<caret>' name=foobar/widgets}",
"{s name=<caret>} name=foobar/widgets}",
};
for (String s : dataProvider) {
assertCompletionContains(
JavaScriptFileType.INSTANCE,
"//{namespace name=foobar/widgets}\n" +
"var foo = {foo: \"" + s + "\"}",
"swag-last-registrations/customer"
);
}
}
示例10: testCompletionPrefixForSnippetNamespace
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testCompletionPrefixForSnippetNamespace() {
String[] dataProvider = {
"{s namespace='<caret>'}",
"{s namespace=<caret>}",
};
for (String s : dataProvider) {
assertCompletionContains(
JavaScriptFileType.INSTANCE,
"var foo = {foo: \"" + s + "\"}",
"foobar/widgets"
);
}
}
示例11: testCompletionPrefixForCommentNamespace
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testCompletionPrefixForCommentNamespace() {
assertCompletionContains(
JavaScriptFileType.INSTANCE,
"//{namespace name=<caret>}",
"foobar/widgets"
);
}
示例12: testSnippetsNavigation
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testSnippetsNavigation() {
assertNavigationMatch(
JavaScriptFileType.INSTANCE,
"var foo = \"{s name='swag-last-registr<caret>ations/customer' namespace='foobar/widgets'}{/s}\"",
PlatformPatterns.psiFile()
);
}
示例13: testNamespaceAsCommentNavigation
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
public void testNamespaceAsCommentNavigation() {
assertNavigationMatch(
JavaScriptFileType.INSTANCE,
"\n//{namespace name=foo<caret>bar/widgets}",
PlatformPatterns.psiFile()
);
}
示例14: testGetNamespaceFromStringLiteral
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
/**
* @see ExtJsUtil#getNamespaceFromStringLiteral
*/
public void testGetNamespaceFromStringLiteral() {
myFixture.configureByText(
JavaScriptFileType.INSTANCE,
"var foo = { foo: \"{s name=backend/inde<caret>x/view/widgets namespace='foobar'}\"}"
);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent();
assertEquals("foobar", ExtJsUtil.getNamespaceFromStringLiteral((JSLiteralExpression) psiElement));
}
示例15: resolveModuleImpl
import com.intellij.lang.javascript.JavaScriptFileType; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public Module resolveModuleImpl(@NotNull PsiDirectory psiDirectory, @NotNull FileType fileType)
{
if(fileType == CSharpFileType.INSTANCE)
{
return findModule(psiDirectory, "CSharp");
}
else if(fileType == JavaScriptFileType.INSTANCE)
{
return findModule(psiDirectory, "UnityScript");
}
return null;
}