Java Code Examples for com.intellij.openapi.fileTypes.PlainTextLanguage#INSTANCE
The following examples show how to use
com.intellij.openapi.fileTypes.PlainTextLanguage#INSTANCE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LSPQuickDocAction.java From lsp4intellij with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument()); Language language = PsiManager.getInstance(editor.getProject()).findFile(file).getLanguage(); //Hack for IntelliJ 2018 TODO proper way if (LanguageDocumentation.INSTANCE.allForLanguage(language).isEmpty() || (Integer.parseInt(ApplicationInfo.getInstance().getMajorVersion()) > 2017) && language == PlainTextLanguage.INSTANCE) { EditorEventManager manager = EditorEventManagerBase.forEditor(editor); if (manager != null) { manager.quickDoc(editor); } else { super.actionPerformed(e); } } else super.actionPerformed(e); }
Example 2
Source File: FluidFileViewProvider.java From idea-php-typo3-plugin with MIT License | 6 votes |
public FluidFileViewProvider(PsiManager manager, VirtualFile file, boolean physical) { super(manager, file, physical); Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file); if (dataLang == null) { dataLang = StdFileTypes.HTML.getLanguage(); } if (dataLang instanceof TemplateLanguage) { myTemplateDataLanguage = PlainTextLanguage.INSTANCE; } else { // The substitutor signals, that a files content should be substituted Language mySubstitutedLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject()); if (mySubstitutedLanguage == FluidLanguage.INSTANCE) { this.myTemplateDataLanguage = StdFileTypes.HTML.getLanguage(); } else { this.myTemplateDataLanguage = mySubstitutedLanguage; } } }
Example 3
Source File: CodeStyleManager.java From editorconfig-jetbrains with MIT License | 5 votes |
private void applyCodeStyleSettings(final List<OutPair> outPairs, final CodeStyleSettings codeStyleSettings, final VirtualFile file) { // Apply indent options final String indentSize = Utils.configValueForKey(outPairs, indentSizeKey); final String tabWidth = Utils.configValueForKey(outPairs, tabWidthKey); final String indentStyle = Utils.configValueForKey(outPairs, indentStyleKey); final FileType fileType = file.getFileType(); final Language language = fileType instanceof LanguageFileType ? ((LanguageFileType)fileType).getLanguage() : PlainTextLanguage.INSTANCE; final CommonCodeStyleSettings commonSettings = codeStyleSettings.getCommonSettings(language); final CommonCodeStyleSettings.IndentOptions indentOptions = commonSettings.getIndentOptions(); applyIndentOptions(indentOptions, indentSize, tabWidth, indentStyle, file.getCanonicalPath()); }
Example 4
Source File: SingleRootFileViewProvider.java From consulo with Apache License 2.0 | 5 votes |
private static Language calcBaseLanguage(@Nonnull VirtualFile file, @Nonnull Project project, @Nonnull final FileType fileType) { if (fileType.isBinary()) return Language.ANY; if (isTooLargeForIntelligence(file)) return PlainTextLanguage.INSTANCE; Language language = LanguageUtil.getLanguageForPsi(project, file); return language != null ? language : PlainTextLanguage.INSTANCE; }
Example 5
Source File: TypedHandler.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull static FileType getFileType(@Nonnull PsiFile file, @Nonnull Editor editor) { FileType fileType = file.getFileType(); Language language = PsiUtilBase.getLanguageInEditor(editor, file.getProject()); if (language != null && language != PlainTextLanguage.INSTANCE) { LanguageFileType associatedFileType = language.getAssociatedFileType(); if (associatedFileType != null) fileType = associatedFileType; } return fileType; }
Example 6
Source File: TextFieldWithAutoCompletion.java From consulo with Apache License 2.0 | 5 votes |
public TextFieldWithAutoCompletion(final Project project, @Nonnull final TextFieldWithAutoCompletionListProvider<T> provider, final boolean showAutocompletionIsAvailableHint, @Nullable final String text) { super(PlainTextLanguage.INSTANCE, project, text == null ? "" : text); myShowAutocompletionIsAvailableHint = showAutocompletionIsAvailableHint; myProvider = provider; TextFieldWithAutoCompletionContributor.installCompletion(getDocument(), project, provider, true); }
Example 7
Source File: TextFieldWithCompletion.java From consulo with Apache License 2.0 | 5 votes |
public TextFieldWithCompletion(@Nullable Project project, @Nonnull TextCompletionProvider provider, @Nonnull String value, boolean oneLineMode, boolean autoPopup, boolean forceAutoPopup, boolean showHint) { super(PlainTextLanguage.INSTANCE, project, value, new TextCompletionUtil.DocumentWithCompletionCreator(provider, autoPopup), oneLineMode); myForceAutoPopup = forceAutoPopup; myShowHint = showHint; }
Example 8
Source File: ScratchFileActions.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { Project project = e.getProject(); if (project == null) return; ScratchFileCreationHelper.Context context = createContext(e, project); context.filePrefix = "buffer"; context.createOption = ScratchFileService.Option.create_if_missing; context.fileCounter = ScratchFileActions::nextBufferIndex; if (context.language == null) context.language = PlainTextLanguage.INSTANCE; doCreateNewScratch(project, context); }
Example 9
Source File: DustFileViewProvider.java From Intellij-Dust with MIT License | 5 votes |
public DustFileViewProvider(PsiManager manager, VirtualFile file, boolean physical) { super(manager, file, physical); // get the main language of the file Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file); if (dataLang == null) dataLang = StdFileTypes.HTML.getLanguage(); // some magic? if (dataLang instanceof TemplateLanguage) { myTemplateDataLanguage = PlainTextLanguage.INSTANCE; } else { myTemplateDataLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject()); } }
Example 10
Source File: LSPPSiElement.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
@NotNull @Override public Language getLanguage() { return PlainTextLanguage.INSTANCE; }
Example 11
Source File: CsvLanguage.java From intellij-csv-validator with Apache License 2.0 | 4 votes |
private CsvLanguage() { super(PlainTextLanguage.INSTANCE, "csv"); }
Example 12
Source File: PsiPlainTextFileImpl.java From consulo with Apache License 2.0 | 4 votes |
public PsiPlainTextFileImpl(FileViewProvider viewProvider) { super(PlainTextTokenTypes.PLAIN_TEXT_FILE, PlainTextTokenTypes.PLAIN_TEXT_FILE, viewProvider); myFileType = viewProvider.getBaseLanguage() != PlainTextLanguage.INSTANCE ? PlainTextFileType.INSTANCE : viewProvider.getFileType(); }
Example 13
Source File: DummyHolder.java From consulo with Apache License 2.0 | 4 votes |
public DummyHolder(@Nonnull PsiManager manager, CharTable table, boolean validity) { this(manager, null, null, table, Boolean.valueOf(validity), PlainTextLanguage.INSTANCE); }
Example 14
Source File: LSPPsiElement.java From lsp4intellij with Apache License 2.0 | 2 votes |
/** * Returns the language of the PSI element. * * @return the language instance. */ @NotNull public Language getLanguage() { return PlainTextLanguage.INSTANCE; }