├── .github ├── FUNDING.yml ├── workflows │ ├── Windows.runsettings │ └── build.yaml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── CODE_OF_CONDUCT.md └── CONTRIBUTING.md ├── art └── EmojiSense.gif ├── src ├── Resources │ └── Icon.png ├── VSCommandTable.vsct ├── Properties │ └── AssemblyInfo.cs ├── source.extension.cs ├── EmojiSensePackage.cs ├── VSCommandTable.cs ├── source.extension.vsixmanifest ├── EmojiSense.csproj ├── IntelliSense.cs ├── Emojis.cs └── CharHelper.cs ├── vs-publish.json ├── README.md ├── EmojiSense.sln ├── .gitattributes ├── .editorconfig ├── .gitignore └── LICENSE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: madskristensen 4 | -------------------------------------------------------------------------------- /art/EmojiSense.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/EmojiSense/master/art/EmojiSense.gif -------------------------------------------------------------------------------- /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/EmojiSense/master/src/Resources/Icon.png -------------------------------------------------------------------------------- /vs-publish.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/vsix-publish", 3 | "categories": [ "coding", "documentation" ], 4 | "identity": { 5 | "internalName": "EmojiSense", 6 | "tags": [ "emoji", "unicode", "intellisense" ] 7 | }, 8 | "assetFiles": [ 9 | { 10 | "pathOnDisk": "art/EmojiSense.gif", 11 | "targetPath": "art/EmojiSense.gif" 12 | } 13 | ], 14 | "overview": "README.md", 15 | "publisher": "MadsKristensen", 16 | "repo": "https://github.com/MadsKristensen/EmojiSense" 17 | } -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/workflows/Windows.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %GITHUB_WORKSPACE% 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using EmojiSense; 2 | 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | [assembly: AssemblyTitle(Vsix.Name)] 7 | [assembly: AssemblyDescription(Vsix.Description)] 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany(Vsix.Author)] 10 | [assembly: AssemblyProduct(Vsix.Name)] 11 | [assembly: AssemblyCopyright(Vsix.Author)] 12 | [assembly: AssemblyTrademark("")] 13 | [assembly: AssemblyCulture("")] 14 | 15 | [assembly: ComVisible(false)] 16 | 17 | [assembly: AssemblyVersion(Vsix.Version)] 18 | [assembly: AssemblyFileVersion(Vsix.Version)] 19 | 20 | namespace System.Runtime.CompilerServices 21 | { 22 | public class IsExternalInit { } 23 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace EmojiSense 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "EmojiSense.2461fd3c-53c0-4e86-a00f-52d181d4a194"; 11 | public const string Name = "EmojiSense"; 12 | public const string Description = @"IntelliSense for emojis in code comments and string for all languages"; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.0"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "emoji, unicode, char"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/EmojiSensePackage.cs: -------------------------------------------------------------------------------- 1 | global using Community.VisualStudio.Toolkit; 2 | global using Microsoft.VisualStudio.Shell; 3 | global using System; 4 | global using Task = System.Threading.Tasks.Task; 5 | using System.Runtime.InteropServices; 6 | using System.Threading; 7 | 8 | namespace EmojiSense 9 | { 10 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 11 | [InstalledProductRegistration(Vsix.Name, Vsix.Description, Vsix.Version)] 12 | [ProvideMenuResource("Menus.ctmenu", 1)] 13 | [Guid(PackageGuids.EmojiSenseString)] 14 | public sealed class EmojiSensePackage : ToolkitPackage 15 | { 16 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 17 | { 18 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace EmojiSense 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string EmojiSenseString = "63ed108b-1f54-482f-90d1-0b2c753e0d2a"; 16 | public static Guid EmojiSense = new Guid(EmojiSenseString); 17 | } 18 | /// 19 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 20 | /// 21 | internal sealed partial class PackageIds 22 | { 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [marketplace]: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.EmojiSense 2 | [vsixgallery]: http://vsixgallery.com/extension/EmojiSense.2461fd3c-53c0-4e86-a00f-52d181d4a194/ 3 | [repo]:https://github.com/madskristensen/EmojiSense 4 | 5 | # EmojiSense for Visual Studio 6 | 7 | [![Build](https://github.com/madskristensen/EmojiSense/actions/workflows/build.yaml/badge.svg)](https://github.com/madskristensen/EmojiSense/actions/workflows/build.yaml) 8 | 9 | Download this extension from the [Visual Studio Marketplace][marketplace] 10 | or get the [CI build][vsixgallery]. 11 | 12 | -------------------------------------- 13 | 14 | Gives IntelliSense for emojis inside strings and comments in the Visual Studio editor. Just type a colon to show the list of available emojis 15 | 16 | ![EmojiSense](art/EmojiSense.gif) 17 | 18 | Inspired by [:emojisense:](https://marketplace.visualstudio.com/items?itemName=bierner.emojisense) for VS Code by [Matt Bierner](https://github.com/mattbierner) 19 | 20 | ## How can I help? 21 | If you enjoy using the extension, please give it a ★★★★★ rating on the [Visual Studio Marketplace][marketplace]. 22 | 23 | Should you encounter bugs or if you have feature requests, head on over to the [GitHub repo][repo] to open an issue if one doesn't already exist. 24 | 25 | Pull requests are also very welcome, since I can't always get around to fixing all bugs myself. This is a personal passion project, so my time is limited. 26 | 27 | Another way to help out is to [sponsor me on GitHub](https://github.com/sponsors/madskristensen). 28 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EmojiSense 6 | IntelliSense for emojis in code comments and string for all languages 7 | https://github.com/madskristensen/EmojiSense 8 | Resources\LICENSE 9 | Resources\Icon.png 10 | Resources\Icon.png 11 | emoji, unicode, char 12 | 13 | 14 | 15 | amd64 16 | 17 | 18 | arm64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /EmojiSense.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33108.404 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmojiSense", "src\EmojiSense.csproj", "{F8917353-B3A1-4368-8A55-DA1008E6DBDB}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{29BB8FA8-47B8-4080-B0C9-75EAD9FB1088}" 9 | ProjectSection(SolutionItems) = preProject 10 | README.md = README.md 11 | vs-publish.json = vs-publish.json 12 | EndProjectSection 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Debug|arm64 = Debug|arm64 18 | Debug|x86 = Debug|x86 19 | Release|Any CPU = Release|Any CPU 20 | Release|arm64 = Release|arm64 21 | Release|x86 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|arm64.ActiveCfg = Debug|arm64 27 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|arm64.Build.0 = Debug|arm64 28 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|x86.ActiveCfg = Debug|x86 29 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Debug|x86.Build.0 = Debug|x86 30 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|arm64.ActiveCfg = Release|arm64 33 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|arm64.Build.0 = Release|arm64 34 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|x86.ActiveCfg = Release|x86 35 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB}.Release|x86.Build.0 = Release|x86 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {6F4AA1CE-9B1B-4141-A2DF-25FFDB9D029B} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json 2 | name: "Build" 3 | 4 | on: 5 | push: 6 | branches: [master] 7 | pull_request: 8 | branches: [master] 9 | workflow_dispatch: 10 | branches: [master] 11 | 12 | jobs: 13 | build: 14 | outputs: 15 | version: ${{ steps.vsix_version.outputs.version-number }} 16 | name: Build 17 | runs-on: windows-2022 18 | env: 19 | Configuration: Release 20 | DeployExtension: False 21 | VsixManifestPath: src\source.extension.vsixmanifest 22 | VsixManifestSourcePath: src\source.extension.cs 23 | 24 | steps: 25 | - uses: actions/checkout@v3 26 | 27 | - name: Setup .NET build dependencies 28 | uses: timheuer/bootstrap-dotnet@v1 29 | with: 30 | nuget: 'false' 31 | sdk: 'false' 32 | msbuild: 'true' 33 | 34 | - name: Increment VSIX version 35 | id: vsix_version 36 | uses: timheuer/vsix-version-stamp@v1 37 | with: 38 | manifest-file: ${{ env.VsixManifestPath }} 39 | vsix-token-source-file: ${{ env.VsixManifestSourcePath }} 40 | 41 | - name: Build 42 | run: msbuild /v:m -restore /p:OutDir=\_built 43 | 44 | - name: Upload artifact 45 | uses: actions/upload-artifact@v3 46 | with: 47 | name: ${{ github.event.repository.name }}.vsix 48 | path: /_built/**/*.vsix 49 | 50 | publish: 51 | if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} 52 | needs: build 53 | runs-on: windows-latest 54 | 55 | steps: 56 | - uses: actions/checkout@v3 57 | 58 | - name: Download Package artifact 59 | uses: actions/download-artifact@v3 60 | with: 61 | name: ${{ github.event.repository.name }}.vsix 62 | 63 | - name: Upload to Open VSIX 64 | uses: timheuer/openvsixpublish@v1 65 | with: 66 | vsix-file: ${{ github.event.repository.name }}.vsix 67 | 68 | - name: Tag and Release 69 | if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 70 | id: tag_release 71 | uses: softprops/action-gh-release@v0.1.13 72 | with: 73 | body: Release ${{ needs.build.outputs.version }} 74 | tag_name: ${{ needs.build.outputs.version }} 75 | files: | 76 | **/*.vsix 77 | 78 | - name: Publish extension to Marketplace 79 | if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 80 | uses: cezarypiatek/VsixPublisherAction@0.1 81 | with: 82 | extension-file: '${{ github.event.repository.name }}.vsix' 83 | publish-manifest-file: 'vs-publish.json' 84 | personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Don't use tabs for indentation. 7 | [*] 8 | indent_style = space 9 | end_of_line = crlf 10 | # (Please don't specify an indent_size here; that has too many unintended consequences.) 11 | 12 | # Code files 13 | [*.{cs,csx,vb,vbx,xaml}] 14 | indent_size = 4 15 | 16 | # Xml project files 17 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 18 | indent_size = 2 19 | 20 | # Xml config files 21 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] 22 | indent_size = 2 23 | 24 | # JSON files 25 | [*.json] 26 | indent_size = 2 27 | 28 | # Dotnet code style settings: 29 | [*.{cs,vb}] 30 | # Sort using and Import directives with System.* appearing first 31 | dotnet_sort_system_directives_first = true 32 | dotnet_separate_import_directive_groups = false 33 | 34 | # Avoid "this." and "Me." if not necessary 35 | dotnet_style_qualification_for_field = false : suggestion 36 | dotnet_style_qualification_for_property = false : suggestion 37 | dotnet_style_qualification_for_method = false : suggestion 38 | dotnet_style_qualification_for_event = false : suggestion 39 | 40 | # Use language keywords instead of framework type names for type references 41 | dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion 42 | dotnet_style_predefined_type_for_member_access = true : suggestion 43 | 44 | # Suggest more modern language features when available 45 | dotnet_style_object_initializer = true : suggestion 46 | dotnet_style_collection_initializer = true : suggestion 47 | dotnet_style_coalesce_expression = true : suggestion 48 | dotnet_style_null_propagation = true : suggestion 49 | dotnet_style_explicit_tuple_names = true : suggestion 50 | 51 | # Naming rules - async methods to be prefixed with Async 52 | dotnet_naming_rule.async_methods_must_end_with_async.severity = warning 53 | dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols 54 | dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style 55 | 56 | dotnet_naming_symbols.method_symbols.applicable_kinds = method 57 | dotnet_naming_symbols.method_symbols.required_modifiers = async 58 | 59 | dotnet_naming_style.end_in_async_style.capitalization = pascal_case 60 | dotnet_naming_style.end_in_async_style.required_suffix = Async 61 | 62 | # Naming rules - private fields must start with an underscore 63 | dotnet_naming_rule.field_must_start_with_underscore.severity = warning 64 | dotnet_naming_rule.field_must_start_with_underscore.symbols = private_fields 65 | dotnet_naming_rule.field_must_start_with_underscore.style = start_underscore_style 66 | 67 | dotnet_naming_symbols.private_fields.applicable_kinds = field 68 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private 69 | 70 | dotnet_naming_style.start_underscore_style.capitalization = camel_case 71 | dotnet_naming_style.start_underscore_style.required_prefix = _ 72 | 73 | # CSharp code style settings: 74 | [*.cs] 75 | # Prefer "var" everywhere 76 | csharp_style_var_for_built_in_types =false:error 77 | csharp_style_var_when_type_is_apparent =false:error 78 | csharp_style_var_elsewhere =false:error 79 | 80 | # Prefer method-like constructs to have a block body 81 | csharp_style_expression_bodied_methods = false : none 82 | csharp_style_expression_bodied_constructors = false : none 83 | csharp_style_expression_bodied_operators = false : none 84 | 85 | # Prefer property-like constructs to have an expression-body 86 | csharp_style_expression_bodied_properties = true : none 87 | csharp_style_expression_bodied_indexers = true : none 88 | csharp_style_expression_bodied_accessors = true : none 89 | 90 | # Suggest more modern language features when available 91 | csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion 92 | csharp_style_pattern_matching_over_as_with_null_check = true : suggestion 93 | csharp_style_inlined_variable_declaration = true : suggestion 94 | csharp_style_throw_expression = true : suggestion 95 | csharp_style_conditional_delegate_call = true : suggestion 96 | 97 | # Newline settings 98 | csharp_new_line_before_open_brace = all 99 | csharp_new_line_before_else = true 100 | csharp_new_line_before_catch = true 101 | csharp_new_line_before_finally = true 102 | csharp_new_line_before_members_in_object_initializers = true 103 | csharp_new_line_before_members_in_anonymous_types = true 104 | 105 | # IDE 106 | dotnet_diagnostic.IDE0058.severity = none 107 | dotnet_diagnostic.RS2008.severity = none # RS2008: Enable analyzer release tracking 108 | -------------------------------------------------------------------------------- /src/EmojiSense.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 5 | 10 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 2.0 12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | {F8917353-B3A1-4368-8A55-DA1008E6DBDB} 14 | Library 15 | Properties 16 | EmojiSense 17 | EmojiSense 18 | v4.8 19 | true 20 | true 21 | true 22 | true 23 | false 24 | true 25 | true 26 | Program 27 | $(DevEnvDir)devenv.exe 28 | /rootsuffix Exp 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | True 55 | True 56 | source.extension.vsixmanifest 57 | 58 | 59 | 60 | 61 | Menus.ctmenu 62 | VsctGenerator 63 | VSCommandTable.cs 64 | 65 | 66 | True 67 | True 68 | VSCommandTable.vsct 69 | 70 | 71 | 72 | 73 | Resources\LICENSE 74 | true 75 | 76 | 77 | Designer 78 | VsixManifestGenerator 79 | source.extension.cs 80 | 81 | 82 | PreserveNewest 83 | true 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | compile; build; native; contentfiles; analyzers; buildtransitive 95 | 96 | 97 | runtime; build; native; contentfiles; analyzers; buildtransitive 98 | all 99 | 100 | 101 | 102 | 103 | 110 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | @mkristensen on Twitter. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](https://marketplace.visualstudio.com/items?itemName=vs-publisher-147549.BatchFormat). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /src/IntelliSense.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using System.Collections.Immutable; 4 | using System.ComponentModel.Composition; 5 | using System.Linq; 6 | using System.Text.RegularExpressions; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.VisualStudio.Core.Imaging; 10 | using Microsoft.VisualStudio.Imaging; 11 | using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; 12 | using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data; 13 | using Microsoft.VisualStudio.Text; 14 | using Microsoft.VisualStudio.Text.Adornments; 15 | using Microsoft.VisualStudio.Text.Editor; 16 | using Microsoft.VisualStudio.Utilities; 17 | using Microsoft.VisualStudio.Text.Classification; 18 | 19 | namespace EmojiSense 20 | { 21 | [Export(typeof(IAsyncCompletionSourceProvider))] 22 | [ContentType("text")] 23 | [Name(nameof(IntelliSense))] 24 | public class IntelliSense : IAsyncCompletionSourceProvider 25 | { 26 | [Import] 27 | public IClassifierAggregatorService ClassifierAggregatorService { get; set; } 28 | 29 | public IAsyncCompletionSource GetOrCreate(ITextView textView) 30 | { 31 | IClassifier classifier = ClassifierAggregatorService.GetClassifier(textView.TextBuffer); 32 | return textView.Properties.GetOrCreateSingletonProperty(() => new AsyncCompletionSource(classifier)); 33 | } 34 | } 35 | 36 | public class AsyncCompletionSource : IAsyncCompletionSource 37 | { 38 | private static string[] _supportedClassifications = new[] { "string", "comment", "CSS Comment", "CSS String Value", "HTML Comment", "XML Comment" }; 39 | 40 | private readonly IClassifier _classifier; 41 | private static ImmutableArray _cache; 42 | private static readonly ImageElement _icon = new(KnownMonikers.GlyphRight.ToImageId(), "Variable"); 43 | private static readonly Regex _regex = new(@"(?:\s|^):([^:\s]*):?", RegexOptions.Compiled); 44 | 45 | public static CompletionFilter PeopleFilter = new("People", "P", new ImageElement(KnownMonikers.FeedbackSmile.ToImageId())); 46 | public static CompletionFilter NatureFilter = new("Nature", "N", new ImageElement(KnownMonikers.BlankWebSite.ToImageId())); 47 | public static CompletionFilter ObjectFilter = new("Objects", "O", new ImageElement(KnownMonikers.NotificationAlertMute.ToImageId())); 48 | public static CompletionFilter PlacesFilter = new("Places", "L", new ImageElement(KnownMonikers.FlagGroup.ToImageId())); 49 | public static CompletionFilter SymbolsFilter = new("Symbols", "S", new ImageElement(KnownMonikers.LineArrow.ToImageId())); 50 | 51 | public AsyncCompletionSource(IClassifier classifier) 52 | { 53 | _classifier = classifier; 54 | } 55 | 56 | public Task GetCompletionContextAsync(IAsyncCompletionSession session, CompletionTrigger trigger, SnapshotPoint triggerLocation, SnapshotSpan applicableToSpan, CancellationToken token) 57 | { 58 | if (_cache == null) 59 | { 60 | var people = Emojis.People.Select(e => CreateCompletionItem(e, PeopleFilter)); 61 | var nature = Emojis.Nature.Select(e => CreateCompletionItem(e, NatureFilter)); 62 | var objects = Emojis.Objects.Select(e => CreateCompletionItem(e, ObjectFilter)); 63 | var places = Emojis.Places.Select(e => CreateCompletionItem(e, PlacesFilter)); 64 | var symbols = Emojis.Symbols.Select(e => CreateCompletionItem(e, SymbolsFilter)); 65 | _cache = people.Union(nature).Union(objects).Union(places).Union(symbols).ToImmutableArray(); 66 | } 67 | 68 | return Task.FromResult(new CompletionContext(_cache)); 69 | } 70 | 71 | private CompletionItem CreateCompletionItem(KeyValuePair emojiPair, CompletionFilter compFilter) 72 | { 73 | string name = emojiPair.Key; 74 | string displayName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(name.Trim(':')); 75 | string value = emojiPair.Value; 76 | ImmutableArray filter = new List() { compFilter }.ToImmutableArray(); 77 | ImmutableArray icons = ImmutableArray.Empty; 78 | 79 | return new CompletionItem(displayName, this, _icon, filter, value, value, displayName, displayName, icons); 80 | } 81 | 82 | public Task GetDescriptionAsync(IAsyncCompletionSession session, CompletionItem item, CancellationToken token) 83 | { 84 | return Task.FromResult(null); 85 | } 86 | 87 | public CompletionStartData InitializeCompletion(CompletionTrigger trigger, SnapshotPoint triggerLocation, CancellationToken token) 88 | { 89 | if (trigger.Character == ':' && 90 | (triggerLocation == triggerLocation.Snapshot.Length || 91 | (triggerLocation.GetChar() != ':' && 92 | !triggerLocation.GetChar().IsWhiteSpaceOrZero()))) 93 | { 94 | return CompletionStartData.DoesNotParticipateInCompletion; 95 | } 96 | 97 | if (trigger.Character != ':') 98 | { 99 | return CompletionStartData.DoesNotParticipateInCompletion; 100 | } 101 | 102 | ITextSnapshotLine line = triggerLocation.GetContainingLine(); 103 | 104 | var classifications = _classifier.GetClassificationSpans(line.Extent); 105 | var triggerClassification = classifications.LastOrDefault(c => c.Span.Contains(triggerLocation - 1)); 106 | 107 | if (triggerClassification == null || !_supportedClassifications.Any(c => triggerClassification.ClassificationType.IsOfType(c))) 108 | { 109 | return CompletionStartData.DoesNotParticipateInCompletion; 110 | } 111 | 112 | string lineText = line.GetText(); 113 | 114 | foreach (Match match in _regex.Matches(lineText)) 115 | { 116 | int offset = match.Value[0].IsWhiteSpaceOrZero() ? 1 : 0; 117 | int start = match.Index + line.Start + offset; 118 | int end = start + match.Length - offset; 119 | 120 | if (triggerLocation >= start && triggerLocation <= end) 121 | { 122 | SnapshotSpan span = new(triggerLocation.Snapshot, Span.FromBounds(start, end)); 123 | return new CompletionStartData(CompletionParticipation.ProvidesItems, span); 124 | } 125 | } 126 | return CompletionStartData.DoesNotParticipateInCompletion; 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Mads Kristensen 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/Emojis.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace EmojiSense 4 | { 5 | internal static class Emojis 6 | { 7 | public static Dictionary People = new() 8 | { 9 | {":alien:","👽"}, 10 | {":angel:","👼"}, 11 | {":anger:","💢"}, 12 | {":angry:","😠"}, 13 | {":anguished:","😧"}, 14 | {":astonished:","😲"}, 15 | {":baby:","👶"}, 16 | {":blue heart:","💙"}, 17 | {":blush:","😊"}, 18 | {":boom:","💥"}, 19 | {":bow:","🙇"}, 20 | {":boy:","👦"}, 21 | {":bride with veil:","👰"}, 22 | {":broken heart:","💔"}, 23 | {":bust in silhouette:","👤"}, 24 | {":busts in silhouette:","👥"}, 25 | {":clap:","👏"}, 26 | {":cold sweat:","😰"}, 27 | {":collision:","💥"}, 28 | {":confounded:","😖"}, 29 | {":confused:","😕"}, 30 | {":construction worker:","👷"}, 31 | {":cop:","👮"}, 32 | {":couple with heart:","💑"}, 33 | {":couple:","👫"}, 34 | {":couplekiss:","💏"}, 35 | {":cry:","😢"}, 36 | {":crying cat face:","😿"}, 37 | {":cupid:","💘"}, 38 | {":dancer:","💃"}, 39 | {":dancers:","👯"}, 40 | {":dash:","💨"}, 41 | {":disappointed relieved:","😥"}, 42 | {":disappointed:","😞"}, 43 | {":dizzy face:","😵"}, 44 | {":dizzy:","💫"}, 45 | {":droplet:","💧"}, 46 | {":ear:","👂"}, 47 | {":exclamation:","❗"}, 48 | {":expressionless:","😑"}, 49 | {":eyes:","👀"}, 50 | {":facepunch:","👊"}, 51 | {":family:","👪"}, 52 | {":fearful:","😨"}, 53 | {":feet:","🐾"}, 54 | {":fire:","🔥"}, 55 | {":fist:","✊"}, 56 | {":flushed:","😳"}, 57 | {":frowning:","😦"}, 58 | {":fu:","🖕"}, 59 | {":girl:","👧"}, 60 | {":green heart:","💚"}, 61 | {":grey exclamation:","❕"}, 62 | {":grey question:","❔"}, 63 | {":grimacing:","😬"}, 64 | {":grin:","😁"}, 65 | {":grinning:","😀"}, 66 | {":guardsman:","💂"}, 67 | {":haircut:","💇"}, 68 | {":hand:","✋"}, 69 | {":hankey:","💩"}, 70 | {":hear no evil:","🙉"}, 71 | {":heart eyes cat:","😻"}, 72 | {":heart eyes:","😍"}, 73 | {":heart:","❤"}, 74 | {":heartbeat:","💓"}, 75 | {":heartpulse:","💗"}, 76 | {":hushed:","😯"}, 77 | {":imp:","👿"}, 78 | {":information desk person:","💁"}, 79 | {":innocent:","😇"}, 80 | {":japanese goblin:","👺"}, 81 | {":japanese ogre:","👹"}, 82 | {":joy cat:","😹"}, 83 | {":joy:","😂"}, 84 | {":kiss:","💋"}, 85 | {":kissing cat:","😽"}, 86 | {":kissing closed eyes:","😚"}, 87 | {":kissing heart:","😘"}, 88 | {":kissing smiling eyes:","😙"}, 89 | {":kissing:","😗"}, 90 | {":laughing:","😆"}, 91 | {":lips:","👄"}, 92 | {":love letter:","💌"}, 93 | {":man with gua pi mao:","👲"}, 94 | {":man with turban:","👳"}, 95 | {":man:","👨"}, 96 | {":mask:","😷"}, 97 | {":massage:","💆"}, 98 | {":metal:","🤘"}, 99 | {":muscle:","💪"}, 100 | {":musical note:","🎵"}, 101 | {":nail care:","💅"}, 102 | {":neutral face:","😐"}, 103 | {":no good:","🙅"}, 104 | {":no mouth:","😶"}, 105 | {":nose:","👃"}, 106 | {":notes:","🎶"}, 107 | {":ok hand:","👌"}, 108 | {":ok woman:","🙆"}, 109 | {":older man:","👴"}, 110 | {":older woman:","👵"}, 111 | {":open hands:","👐"}, 112 | {":open mouth:","😮"}, 113 | {":pensive:","😔"}, 114 | {":persevere:","😣"}, 115 | {":point down:","👇"}, 116 | {":point left:","👈"}, 117 | {":point right:","👉"}, 118 | {":point up 2:","👆"}, 119 | {":point up:","☝"}, 120 | {":poop:","💩"}, 121 | {":pouting cat:","😾"}, 122 | {":pray:","🙏"}, 123 | {":princess:","👸"}, 124 | {":punch:","👊"}, 125 | {":purple heart:","💜"}, 126 | {":question:","❓"}, 127 | {":rage:","😡"}, 128 | {":raised hand:","✋"}, 129 | {":raised hands:","🙌"}, 130 | {":raising hand:","🙋"}, 131 | {":relaxed:","☺"}, 132 | {":relieved:","😌"}, 133 | {":revolving hearts:","💞"}, 134 | {":running:","🏃"}, 135 | {":satisfied:","😆"}, 136 | {":scream cat:","🙀"}, 137 | {":scream:","😱"}, 138 | {":see no evil:","🙈"}, 139 | {":shit:","💩"}, 140 | {":skull:","💀"}, 141 | {":sleeping:","😴"}, 142 | {":sleepy:","😪"}, 143 | {":smile cat:","😸"}, 144 | {":smile:","😄"}, 145 | {":smiley cat:","😺"}, 146 | {":smiley:","😃"}, 147 | {":smiling imp:","😈"}, 148 | {":smirk cat:","😼"}, 149 | {":smirk:","😏"}, 150 | {":sob:","😭"}, 151 | {":sparkles:","✨"}, 152 | {":sparkling heart:","💖"}, 153 | {":speak no evil:","🙊"}, 154 | {":speech balloon:","💬"}, 155 | {":star:","⭐"}, 156 | {":star2:","🌟"}, 157 | {":stuck out tongue closed eyes:","😝"}, 158 | {":stuck out tongue winking eye:","😜"}, 159 | {":stuck out tongue:","😛"}, 160 | {":sunglasses:","😎"}, 161 | {":sweat drops:","💦"}, 162 | {":sweat smile:","😅"}, 163 | {":sweat:","😓"}, 164 | {":thought balloon:","💭"}, 165 | {":thumbsdown:","👎"}, 166 | {":thumbsup:","👍"}, 167 | {":tired face:","😫"}, 168 | {":tongue:","👅"}, 169 | {":triumph:","😤"}, 170 | {":two hearts:","💕"}, 171 | {":two men holding hands:","👬"}, 172 | {":two women holding hands:","👭"}, 173 | {":unamused:","😒"}, 174 | {":v:","✌"}, 175 | {":walking:","🚶"}, 176 | {":wave:","👋"}, 177 | {":weary:","😩"}, 178 | {":wink:","😉"}, 179 | {":woman:","👩"}, 180 | {":worried:","😟"}, 181 | {":yellow heart:","💛"}, 182 | {":yum:","😋"}, 183 | {":zzz:","💤"}, 184 | }; 185 | 186 | public static Dictionary Nature = new() 187 | { 188 | {":ant:","🐜"}, 189 | {":baby chick:","🐤"}, 190 | {":bear:","🐻"}, 191 | {":beetle:","🪲"}, 192 | {":bird:","🐦"}, 193 | {":blossom:","🌼"}, 194 | {":blowfish:","🐡"}, 195 | {":boar:","🐗"}, 196 | {":bouquet:","💐"}, 197 | {":bug:","🐛"}, 198 | {":cactus:","🌵"}, 199 | {":camel:","🐫"}, 200 | {":cat:","🐱"}, 201 | {":cat2:","🐈"}, 202 | {":cherry blossom:","🌸"}, 203 | {":chestnut:","🌰"}, 204 | {":chicken:","🐔"}, 205 | {":cloud:","☁"}, 206 | {":cow:","🐮"}, 207 | {":cow2:","🐄"}, 208 | {":crocodile:","🐊"}, 209 | {":cyclone:","🌀"}, 210 | {":deciduous tree:","🌳"}, 211 | {":dog:","🐶"}, 212 | {":dog2:","🐕"}, 213 | {":dolphin:","🐬"}, 214 | {":dragon face:","🐲"}, 215 | {":dragon:","🐉"}, 216 | {":dromedary camel:","🐪"}, 217 | {":ear of rice:","🌾"}, 218 | {":earth africa:","🌍"}, 219 | {":earth americas:","🌎"}, 220 | {":earth asia:","🌏"}, 221 | {":elephant:","🐘"}, 222 | {":evergreen tree:","🌲"}, 223 | {":fallen leaf:","🍂"}, 224 | {":first quarter moon with face:","🌛"}, 225 | {":first quarter moon:","🌓"}, 226 | {":fish:","🐟"}, 227 | {":foggy:","🌁"}, 228 | {":four leaf clover:","🍀"}, 229 | {":frog:","🐸"}, 230 | {":full moon with face:","🌝"}, 231 | {":full moon:","🌕"}, 232 | {":globe with meridians:","🌐"}, 233 | {":goat:","🐐"}, 234 | {":hamster:","🐹"}, 235 | {":hatched chick:","🐥"}, 236 | {":hatching chick:","🐣"}, 237 | {":herb:","🌿"}, 238 | {":hibiscus:","🌺"}, 239 | {":honeybee:","🐝"}, 240 | {":horse:","🐴"}, 241 | {":koala:","🐨"}, 242 | {":last quarter moon with face:","🌜"}, 243 | {":last quarter moon:","🌗"}, 244 | {":leaves:","🍃"}, 245 | {":leopard:","🐆"}, 246 | {":maple leaf:","🍁"}, 247 | {":milky way:","🌌"}, 248 | {":monkey face:","🐵"}, 249 | {":monkey:","🐒"}, 250 | {":moon:","🌔"}, 251 | {":mouse:","🐭"}, 252 | {":mouse2:","🐁"}, 253 | {":mushroom:","🍄"}, 254 | {":new moon with face:","🌚"}, 255 | {":new moon:","🌑"}, 256 | {":ocean:","🌊"}, 257 | {":octopus:","🐙"}, 258 | {":ox:","🐂"}, 259 | {":palm tree:","🌴"}, 260 | {":panda face:","🐼"}, 261 | {":partly sunny:","⛅"}, 262 | {":paw prints:","🐾"}, 263 | {":penguin:","🐧"}, 264 | {":pig nose:","🐽"}, 265 | {":pig:","🐷"}, 266 | {":pig2:","🐖"}, 267 | {":poodle:","🐩"}, 268 | {":rabbit:","🐰"}, 269 | {":rabbit2:","🐇"}, 270 | {":racehorse:","🐎"}, 271 | {":ram:","🐏"}, 272 | {":rat:","🐀"}, 273 | {":rooster:","🐓"}, 274 | {":rose:","🌹"}, 275 | {":seedling:","🌱"}, 276 | {":sheep:","🐑"}, 277 | {":shell:","🐚"}, 278 | {":snail:","🐌"}, 279 | {":snake:","🐍"}, 280 | {":snowflake:","❄"}, 281 | {":snowman:","⛄"}, 282 | {":sun with face:","🌞"}, 283 | {":sunflower:","🌻"}, 284 | {":sunny:","☀"}, 285 | {":tiger:","🐯"}, 286 | {":tiger2:","🐅"}, 287 | {":tropical fish:","🐠"}, 288 | {":tulip:","🌷"}, 289 | {":turtle:","🐢"}, 290 | {":umbrella:","☔"}, 291 | {":volcano:","🌋"}, 292 | {":waning crescent moon:","🌘"}, 293 | {":waning gibbous moon:","🌖"}, 294 | {":water buffalo:","🐃"}, 295 | {":waxing crescent moon:","🌒"}, 296 | {":waxing gibbous moon:","🌔"}, 297 | {":whale:","🐳"}, 298 | {":whale2:","🐋"}, 299 | {":wolf:","🐺"}, 300 | {":zap:","⚡"}, 301 | }; 302 | 303 | public static Dictionary Objects = new() 304 | { 305 | {":8ball:","🎱"}, 306 | {":alarm clock:","⏰"}, 307 | {":apple:","🍎"}, 308 | {":art:","🎨"}, 309 | {":baby bottle:","🍼"}, 310 | {":balloon:","🎈"}, 311 | {":bamboo:","🎍"}, 312 | {":banana:","🍌"}, 313 | {":bar chart:","📊"}, 314 | {":baseball:","⚾"}, 315 | {":basketball:","🏀"}, 316 | {":bath:","🛀"}, 317 | {":bathtub:","🛁"}, 318 | {":battery:","🔋"}, 319 | {":beer:","🍺"}, 320 | {":beers:","🍻"}, 321 | {":bell:","🔔"}, 322 | {":bento:","🍱"}, 323 | {":bicyclist:","🚴"}, 324 | {":bikini:","👙"}, 325 | {":birthday:","🎂"}, 326 | {":black joker:","🃏"}, 327 | {":black nib:","✒"}, 328 | {":blue book:","📘"}, 329 | {":bomb:","💣"}, 330 | {":book:","📖"}, 331 | {":bookmark tabs:","📑"}, 332 | {":bookmark:","🔖"}, 333 | {":books:","📚"}, 334 | {":boot:","👢"}, 335 | {":bowling:","🎳"}, 336 | {":bread:","🍞"}, 337 | {":briefcase:","💼"}, 338 | {":bulb:","💡"}, 339 | {":cake:","🍰"}, 340 | {":calendar:","📆"}, 341 | {":calling:","📲"}, 342 | {":camera:","📷"}, 343 | {":candy:","🍬"}, 344 | {":card index:","📇"}, 345 | {":cd:","💿"}, 346 | {":chart with downwards trend:","📉"}, 347 | {":chart with upwards trend:","📈"}, 348 | {":cherries:","🍒"}, 349 | {":chocolate bar:","🍫"}, 350 | {":christmas tree:","🎄"}, 351 | {":clapper:","🎬"}, 352 | {":clipboard:","📋"}, 353 | {":closed book:","📕"}, 354 | {":closed lock with key:","🔐"}, 355 | {":closed umbrella:","🌂"}, 356 | {":clubs:","♣"}, 357 | {":cocktail:","🍸"}, 358 | {":coffee:","☕"}, 359 | {":computer:","💻"}, 360 | {":confetti ball:","🎊"}, 361 | {":cookie:","🍪"}, 362 | {":corn:","🌽"}, 363 | {":credit card:","💳"}, 364 | {":crown:","👑"}, 365 | {":crystal ball:","🔮"}, 366 | {":curry:","🍛"}, 367 | {":custard:","🍮"}, 368 | {":dango:","🍡"}, 369 | {":dart:","🎯"}, 370 | {":date:","📅"}, 371 | {":diamonds:","♦"}, 372 | {":dollar:","💵"}, 373 | {":dolls:","🎎"}, 374 | {":door:","🚪"}, 375 | {":doughnut:","🍩"}, 376 | {":dress:","👗"}, 377 | {":dvd:","📀"}, 378 | {":egg:","🥚"}, 379 | {":eggplant:","🍆"}, 380 | {":electric plug:","🔌"}, 381 | {":email:","📧"}, 382 | {":e-mail:","📧"}, 383 | {":envelope:","✉"}, 384 | {":euro:","💶"}, 385 | {":eyeglasses:","👓"}, 386 | {":fax:","📠"}, 387 | {":file folder:","📁"}, 388 | {":fireworks:","🎆"}, 389 | {":fish cake:","🍥"}, 390 | {":fishing pole and fish:","🎣"}, 391 | {":flags:","🎏"}, 392 | {":flashlight:","🔦"}, 393 | {":floppy disk:","💾"}, 394 | {":flower playing cards:","🎴"}, 395 | {":football:","🏈"}, 396 | {":fork and knife:","🍴"}, 397 | {":fried shrimp:","🍤"}, 398 | {":fries:","🍟"}, 399 | {":game die:","🎲"}, 400 | {":gem:","💎"}, 401 | {":ghost:","👻"}, 402 | {":gift heart:","💝"}, 403 | {":gift:","🎁"}, 404 | {":golf:","⛳"}, 405 | {":grapes:","🍇"}, 406 | {":green apple:","🍏"}, 407 | {":green book:","📗"}, 408 | {":guitar:","🎸"}, 409 | {":gun:","🔫"}, 410 | {":hamburger:","🍔"}, 411 | {":hammer:","🔨"}, 412 | {":handbag:","👜"}, 413 | {":headphones:","🎧"}, 414 | {":hearts:","♥"}, 415 | {":high brightness:","🔆"}, 416 | {":high heel:","👠"}, 417 | {":hocho:","🔪"}, 418 | {":honey pot:","🍯"}, 419 | {":horse racing:","🏇"}, 420 | {":hourglass flowing sand:","⏳"}, 421 | {":hourglass:","⌛"}, 422 | {":ice cream:","🍨"}, 423 | {":icecream:","🍦"}, 424 | {":inbox tray:","📥"}, 425 | {":incoming envelope:","📨"}, 426 | {":iphone:","📱"}, 427 | {":jack o lantern:","🎃"}, 428 | {":jeans:","👖"}, 429 | {":key:","🔑"}, 430 | {":kimono:","👘"}, 431 | {":ledger:","📒"}, 432 | {":lemon:","🍋"}, 433 | {":lipstick:","💄"}, 434 | {":lock with ink pen:","🔏"}, 435 | {":lock:","🔒"}, 436 | {":lollipop:","🍭"}, 437 | {":loop:","➿"}, 438 | {":loudspeaker:","📢"}, 439 | {":low brightness:","🔅"}, 440 | {":mag right:","🔎"}, 441 | {":mag:","🔍"}, 442 | {":mahjong:","🀄"}, 443 | {":mailbox closed:","📪"}, 444 | {":mailbox with mail:","📬"}, 445 | {":mailbox with no mail:","📭"}, 446 | {":mailbox:","📫"}, 447 | {":mans shoe:","👞"}, 448 | {":meat on bone:","🍖"}, 449 | {":mega:","📣"}, 450 | {":melon:","🍈"}, 451 | {":memo:","📝"}, 452 | {":microphone:","🎤"}, 453 | {":microscope:","🔬"}, 454 | {":minidisc:","💽"}, 455 | {":money with wings:","💸"}, 456 | {":moneybag:","💰"}, 457 | {":mortar board:","🎓"}, 458 | {":mountain bicyclist:","🚵"}, 459 | {":movie camera:","🎥"}, 460 | {":musical keyboard:","🎹"}, 461 | {":musical score:","🎼"}, 462 | {":mute:","🔇"}, 463 | {":name badge:","📛"}, 464 | {":necktie:","👔"}, 465 | {":newspaper:","📰"}, 466 | {":no bell:","🔕"}, 467 | {":notebook with decorative cover:","📔"}, 468 | {":notebook:","📓"}, 469 | {":nut and bolt:","🔩"}, 470 | {":oden:","🍢"}, 471 | {":open file folder:","📂"}, 472 | {":orange book:","📙"}, 473 | {":outbox tray:","📤"}, 474 | {":page facing up:","📄"}, 475 | {":page with curl:","📃"}, 476 | {":pager:","📟"}, 477 | {":paperclip:","📎"}, 478 | {":peach:","🍑"}, 479 | {":pear:","🍐"}, 480 | {":pencil:","📝"}, 481 | {":pencil2:","✏"}, 482 | {":phone:","☎"}, 483 | {":pill:","💊"}, 484 | {":pineapple:","🍍"}, 485 | {":pizza:","🍕"}, 486 | {":postal horn:","📯"}, 487 | {":postbox:","📮"}, 488 | {":pouch:","👝"}, 489 | {":poultry leg:","🍗"}, 490 | {":pound:","💷"}, 491 | {":purse:","👛"}, 492 | {":pushpin:","📌"}, 493 | {":radio:","📻"}, 494 | {":ramen:","🍜"}, 495 | {":ribbon:","🎀"}, 496 | {":rice ball:","🍙"}, 497 | {":rice cracker:","🍘"}, 498 | {":rice scene:","🎑"}, 499 | {":rice:","🍚"}, 500 | {":ring:","💍"}, 501 | {":rugby football:","🏉"}, 502 | {":running shirt with sash:","🎽"}, 503 | {":sake:","🍶"}, 504 | {":sandal:","👡"}, 505 | {":santa:","🎅"}, 506 | {":satellite:","📡"}, 507 | {":saxophone:","🎷"}, 508 | {":school satchel:","🎒"}, 509 | {":scissors:","✂"}, 510 | {":scroll:","📜"}, 511 | {":seat:","💺"}, 512 | {":shaved ice:","🍧"}, 513 | {":shirt:","👕"}, 514 | {":shoe:","👞"}, 515 | {":shower:","🚿"}, 516 | {":ski:","🎿"}, 517 | {":smoking:","🚬"}, 518 | {":snowboarder:","🏂"}, 519 | {":soccer:","⚽"}, 520 | {":sound:","🔉"}, 521 | {":space invader:","👾"}, 522 | {":spades:","♠"}, 523 | {":spaghetti:","🍝"}, 524 | {":sparkler:","🎇"}, 525 | {":speaker:","🔈"}, 526 | {":stew:","🍲"}, 527 | {":straight ruler:","📏"}, 528 | {":strawberry:","🍓"}, 529 | {":surfer:","🏄"}, 530 | {":sushi:","🍣"}, 531 | {":sweet potato:","🍠"}, 532 | {":swimmer:","🏊"}, 533 | {":syringe:","💉"}, 534 | {":tada:","🎉"}, 535 | {":tanabata tree:","🎋"}, 536 | {":tangerine:","🍊"}, 537 | {":tea:","🍵"}, 538 | {":telephone receiver:","📞"}, 539 | {":telephone:","☎"}, 540 | {":telescope:","🔭"}, 541 | {":tennis:","🎾"}, 542 | {":toilet:","🚽"}, 543 | {":tomato:","🍅"}, 544 | {":tophat:","🎩"}, 545 | {":triangular ruler:","📐"}, 546 | {":trophy:","🏆"}, 547 | {":tropical drink:","🍹"}, 548 | {":trumpet:","🎺"}, 549 | {":tshirt:","👕"}, 550 | {":tv:","📺"}, 551 | {":unlock:","🔓"}, 552 | {":vhs:","📼"}, 553 | {":video camera:","📹"}, 554 | {":video game:","🎮"}, 555 | {":violin:","🎻"}, 556 | {":watch:","⌚"}, 557 | {":watermelon:","🍉"}, 558 | {":wind chime:","🎐"}, 559 | {":wine glass:","🍷"}, 560 | {":womans clothes:","👚"}, 561 | {":womans hat:","👒"}, 562 | {":wrench:","🔧"}, 563 | {":yen:","💴"}, 564 | }; 565 | 566 | public static Dictionary Places = new() 567 | { 568 | {":aerial tramway:","🚡"}, 569 | {":airplane:","✈"}, 570 | {":ambulance:","🚑"}, 571 | {":anchor:","⚓"}, 572 | {":articulated lorry:","🚛"}, 573 | {":atm:","🏧"}, 574 | {":bank:","🏦"}, 575 | {":barber:","💈"}, 576 | {":beginner:","🔰"}, 577 | {":bike:","🚲"}, 578 | {":blue car:","🚙"}, 579 | {":boat:","⛵"}, 580 | {":bridge at night:","🌉"}, 581 | {":bullettrain front:","🚅"}, 582 | {":bullettrain side:","🚄"}, 583 | {":bus:","🚌"}, 584 | {":busstop:","🚏"}, 585 | {":car:","🚗"}, 586 | {":carousel horse:","🎠"}, 587 | {":checkered flag:","🏁"}, 588 | {":church:","⛪"}, 589 | {":circus tent:","🎪"}, 590 | {":city sunrise:","🌇"}, 591 | {":city sunset:","🌆"}, 592 | {":construction:","🚧"}, 593 | {":convenience store:","🏪"}, 594 | {":crossed flags:","🎌"}, 595 | {":department store:","🏬"}, 596 | {":european castle:","🏰"}, 597 | {":european post office:","🏤"}, 598 | {":factory:","🏭"}, 599 | {":ferris wheel:","🎡"}, 600 | {":fire engine:","🚒"}, 601 | {":fountain:","⛲"}, 602 | {":fuelpump:","⛽"}, 603 | {":helicopter:","🚁"}, 604 | {":hospital:","🏥"}, 605 | {":hotel:","🏨"}, 606 | {":hotsprings:","♨"}, 607 | {":house with garden:","🏡"}, 608 | {":house:","🏠"}, 609 | {":izakaya lantern:","🏮"}, 610 | {":japan:","🗾"}, 611 | {":japanese castle:","🏯"}, 612 | {":light rail:","🚈"}, 613 | {":love hotel:","🏩"}, 614 | {":minibus:","🚐"}, 615 | {":monorail:","🚝"}, 616 | {":mount fuji:","🗻"}, 617 | {":mountain cableway:","🚠"}, 618 | {":mountain railway:","🚞"}, 619 | {":moyai:","🗿"}, 620 | {":office:","🏢"}, 621 | {":oncoming automobile:","🚘"}, 622 | {":oncoming bus:","🚍"}, 623 | {":oncoming police car:","🚔"}, 624 | {":oncoming taxi:","🚖"}, 625 | {":performing arts:","🎭"}, 626 | {":police car:","🚓"}, 627 | {":post office:","🏣"}, 628 | {":railway car:","🚃"}, 629 | {":rainbow:","🌈"}, 630 | {":red car:","🚗"}, 631 | {":rocket:","🚀"}, 632 | {":roller coaster:","🎢"}, 633 | {":rotating light:","🚨"}, 634 | {":round pushpin:","📍"}, 635 | {":rowboat:","🚣"}, 636 | {":sailboat:","⛵"}, 637 | {":school:","🏫"}, 638 | {":ship:","🚢"}, 639 | {":slot machine:","🎰"}, 640 | {":speedboat:","🚤"}, 641 | {":stars:","🌠"}, 642 | {":station:","🚉"}, 643 | {":statue of liberty:","🗽"}, 644 | {":steam locomotive:","🚂"}, 645 | {":sunrise over mountains:","🌄"}, 646 | {":sunrise:","🌅"}, 647 | {":suspension railway:","🚟"}, 648 | {":taxi:","🚕"}, 649 | {":tent:","⛺"}, 650 | {":ticket:","🎫"}, 651 | {":tokyo tower:","🗼"}, 652 | {":tractor:","🚜"}, 653 | {":traffic light:","🚥"}, 654 | {":train:","🚋"}, 655 | {":train2:","🚆"}, 656 | {":tram:","🚊"}, 657 | {":triangular flag on post:","🚩"}, 658 | {":trolleybus:","🚎"}, 659 | {":truck:","🚚"}, 660 | {":vertical traffic light:","🚦"}, 661 | {":warning:","⚠"}, 662 | {":wedding:","💒"}, 663 | }; 664 | 665 | public static Dictionary Symbols = new() 666 | { 667 | {":100:","💯"}, 668 | {":1234:","🔢"}, 669 | {":a:","🅰"}, 670 | {":ab:","🆎"}, 671 | {":abc:","🔤"}, 672 | {":abcd:","🔡"}, 673 | {":accept:","🉑"}, 674 | {":aquarius:","♒"}, 675 | {":aries:","♈:"}, 676 | {":arrow backward:","◀️"}, 677 | {":arrow double down:","⏬"}, 678 | {":arrow down small:","🔽"}, 679 | {":arrow down:","⬇️"}, 680 | {":arrow forward:","▶️"}, 681 | {":arrow heading down:","⤵️"}, 682 | {":arrow heading up:","⤴️"}, 683 | {":arrow left:","⬅️"}, 684 | {":arrow lower left:","↙️"}, 685 | {":arrow lower right:","↘️"}, 686 | {":arrow right hook:","↪️"}, 687 | {":arrow right:","➡️"}, 688 | {":arrow up down:","↕️"}, 689 | {":arrow up small:","🔼"}, 690 | {":arrow up:","⬆️"}, 691 | {":arrow upper left:","↖️"}, 692 | {":arrow upper right:","↗️"}, 693 | {":arrows clockwise:","🔃"}, 694 | {":arrows counterclockwise:","🔄"}, 695 | {":b:","🅱"}, 696 | {":baby symbol:","🚼"}, 697 | {":baggage claim:","🛄"}, 698 | {":ballot box with check:","☑️"}, 699 | {":bangbang:","‼️"}, 700 | {":black square button:","🔲"}, 701 | {":cancer:","♋"}, 702 | {":capital abcd:","🔠"}, 703 | {":capricorn:","♑"}, 704 | {":chart:","💹"}, 705 | {":children crossing:","🚸"}, 706 | {":cinema:","🎦"}, 707 | {":cl:","🆑"}, 708 | {":clock1:","🕐"}, 709 | {":clock10:","🕙"}, 710 | {":clock1030:","🕥"}, 711 | {":clock11:","🕚"}, 712 | {":clock1130:","🕦"}, 713 | {":clock12:","🕛"}, 714 | {":clock1230:","🕧"}, 715 | {":clock130:","🕜"}, 716 | {":clock2:","🕑"}, 717 | {":clock230:","🕝"}, 718 | {":clock3:","🕒"}, 719 | {":clock330:","🕞"}, 720 | {":clock4:","🕓"}, 721 | {":clock430:","🕟"}, 722 | {":clock5:","🕔"}, 723 | {":clock530:","🕠"}, 724 | {":clock6:","🕕"}, 725 | {":clock630:","🕡"}, 726 | {":clock7:","🕖"}, 727 | {":clock730:","🕢"}, 728 | {":clock8:","🕗"}, 729 | {":clock830:","🕣"}, 730 | {":clock9:","🕘"}, 731 | {":clock930:","🕤"}, 732 | {":congratulations:","㊗️"}, 733 | {":cool:","🆒"}, 734 | {":copyright:","©️"}, 735 | {":currency exchange:","💱"}, 736 | {":customs:","🛃"}, 737 | {":diamond shape with a dot inside:","💠"}, 738 | {":do not litter:","🚯"}, 739 | {":eight pointed black star:","✴️"}, 740 | {":eight spoked asterisk:","✳️"}, 741 | {":eight:","8️⃣"}, 742 | {":end:","🔚"}, 743 | {":fast forward:","⏩"}, 744 | {":five:","5️⃣"}, 745 | {":four:","4️⃣"}, 746 | {":free:","🆓"}, 747 | {":gemini:","♊"}, 748 | {":hash:","#️⃣"}, 749 | {":heart decoration:","💟"}, 750 | {":heavy check mark:","✔️"}, 751 | {":heavy division sign:","➗"}, 752 | {":heavy dollar sign:","💲"}, 753 | {":heavy exclamation mark:","❗"}, 754 | {":heavy minus sign:","➖"}, 755 | {":heavy multiplication x:","✖️"}, 756 | {":id:","🆔"}, 757 | {":ideograph advantage:","🉐"}, 758 | {":information source:","ℹ️"}, 759 | {":interrobang:","⁉️"}, 760 | {":keycap ten:","🔟"}, 761 | {":koko:","🈁"}, 762 | {":large blue circle:","🔵"}, 763 | {":large blue diamond:","🔷"}, 764 | {":large orange diamond:","🔶"}, 765 | {":left luggage:","🛅"}, 766 | {":left right arrow:","↔️"}, 767 | {":leftwards arrow with hook:","↩️"}, 768 | {":leo:","♌"}, 769 | {":libra:","♎"}, 770 | {":link:","🔗"}, 771 | {":m:","Ⓜ️"}, 772 | {":mens:","🚹"}, 773 | {":metro:","🚇"}, 774 | {":mobile phone off:","📴"}, 775 | {":negative squared cross mark:","❎"}, 776 | {":new:","🆕"}, 777 | {":ng:","🆖"}, 778 | {":nine:","9️⃣"}, 779 | {":no bicycles:","🚳"}, 780 | {":no entry sign:","🚫"}, 781 | {":no mobile phones:","📵"}, 782 | {":no pedestrians:","🚷"}, 783 | {":no smoking:","🚭"}, 784 | {":non-potable water:","🚱"}, 785 | {":o:","⭕"}, 786 | {":o2:","🅾"}, 787 | {":ok:","🆗"}, 788 | {":on:","🔛"}, 789 | {":one:","1️⃣"}, 790 | {":ophiuchus:","⛎"}, 791 | {":parking:","🅿"}, 792 | {":part alternation mark:","〽️"}, 793 | {":passport control:","🛂"}, 794 | {":pisces:","♓"}, 795 | {":potable water:","🚰"}, 796 | {":put litter in its place:","🚮"}, 797 | {":radio button:","🔘"}, 798 | {":recycle:","♻️"}, 799 | {":red circle:","🔴"}, 800 | {":registered:","®️"}, 801 | {":repeat one:","🔂"}, 802 | {":repeat:","🔁"}, 803 | {":restroom:","🚻"}, 804 | {":rewind:","⏪"}, 805 | {":sa:","🈂"}, 806 | {":sagittarius:","♐"}, 807 | {":scorpius:","♏"}, 808 | {":secret:","㊙️"}, 809 | {":seven:","7️⃣"}, 810 | {":signal strength:","📶"}, 811 | {":six pointed star:","🔯"}, 812 | {":six:","6️⃣"}, 813 | {":small blue diamond:","🔹"}, 814 | {":small orange diamond:","🔸"}, 815 | {":small red triangle down:","🔻"}, 816 | {":small red triangle:","🔺"}, 817 | {":soon:","🔜"}, 818 | {":sos:","🆘"}, 819 | {":symbols:","🔣"}, 820 | {":taurus:","♉"}, 821 | {":three:","3️⃣"}, 822 | {":tm:","™️"}, 823 | {":top:","🔝"}, 824 | {":trident:","🔱"}, 825 | {":twisted rightwards arrows:","🔀"}, 826 | {":two:","2️⃣"}, 827 | {":u5272:","🈹"}, 828 | {":u5408:","🈴"}, 829 | {":u55b6:","🈺"}, 830 | {":u6307:","🈯"}, 831 | {":u6708:","🈷"}, 832 | {":u6709:","🈶"}, 833 | {":u6e80:","🈵"}, 834 | {":u7121:","🈚"}, 835 | {":u7533:","🈸"}, 836 | {":u7981:","🈲"}, 837 | {":u7a7a:","🈳"}, 838 | {":underage:","🔞"}, 839 | {":up:","🆙"}, 840 | {":vibration mode:","📳"}, 841 | {":virgo:","♍"}, 842 | {":vs:","🆚"}, 843 | {":wavy dash:","〰️"}, 844 | {":wc:","🚾"}, 845 | {":wheelchair:","♿"}, 846 | {":white circle:","⚪"}, 847 | {":white flower:","💮"}, 848 | {":white square button:","🔳"}, 849 | {":womens:","🚺"}, 850 | {":x:","❌"}, 851 | {":zero:","0️⃣"}, 852 | {"arrow double up:","⏫"}, 853 | {"black circle:","⚫"}, 854 | {"curly loop:","➰"}, 855 | {"heavy plus sign:","➕"}, 856 | {"hite square: :white square:",":wh"}, 857 | {"lack square: :black square:",":bl"}, 858 | {"no entry:","⛔"}, 859 | {"white check mark:","✅"}, 860 | }; 861 | } 862 | } 863 | -------------------------------------------------------------------------------- /src/CharHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexandre Mutel. All rights reserved. 2 | // This file is licensed under the BSD-Clause 2 license. 3 | // See the license.txt file in the project root for more information. 4 | 5 | using System; 6 | using System.Globalization; 7 | using System.Collections.Generic; 8 | using System.Runtime.CompilerServices; 9 | using System.Diagnostics; 10 | 11 | namespace EmojiSense 12 | { 13 | /// 14 | /// Helper class for handling characters. 15 | /// 16 | public static class CharHelper 17 | { 18 | public const int TabSize = 4; 19 | 20 | public const char ReplacementChar = '\uFFFD'; 21 | 22 | public const string ReplacementCharString = "\uFFFD"; 23 | 24 | private const char HighSurrogateStart = '\ud800'; 25 | private const char HighSurrogateEnd = '\udbff'; 26 | private const char LowSurrogateStart = '\udc00'; 27 | private const char LowSurrogateEnd = '\udfff'; 28 | 29 | // We don't support LCDM 30 | private static readonly Dictionary romanMap = new Dictionary(6) { 31 | { 'i', 1 }, { 'v', 5 }, { 'x', 10 }, 32 | { 'I', 1 }, { 'V', 5 }, { 'X', 10 } 33 | }; 34 | 35 | private static readonly char[] punctuationExceptions = { '−', '-', '†', '‡' }; 36 | 37 | public static void CheckOpenCloseDelimiter(char pc, char c, bool enableWithinWord, out bool canOpen, out bool canClose) 38 | { 39 | pc.CheckUnicodeCategory(out bool prevIsWhiteSpace, out bool prevIsPunctuation); 40 | c.CheckUnicodeCategory(out bool nextIsWhiteSpace, out bool nextIsPunctuation); 41 | 42 | var prevIsExcepted = prevIsPunctuation && punctuationExceptions.Contains(pc); 43 | var nextIsExcepted = nextIsPunctuation && punctuationExceptions.Contains(c); 44 | 45 | // A left-flanking delimiter run is a delimiter run that is 46 | // (1) not followed by Unicode whitespace, and either 47 | // (2a) not followed by a punctuation character or 48 | // (2b) followed by a punctuation character and preceded by Unicode whitespace or a punctuation character. 49 | // For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. 50 | canOpen = !nextIsWhiteSpace && 51 | ((!nextIsPunctuation || nextIsExcepted) || prevIsWhiteSpace || prevIsPunctuation); 52 | 53 | 54 | // A right-flanking delimiter run is a delimiter run that is 55 | // (1) not preceded by Unicode whitespace, and either 56 | // (2a) not preceded by a punctuation character, or 57 | // (2b) preceded by a punctuation character and followed by Unicode whitespace or a punctuation character. 58 | // For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. 59 | canClose = !prevIsWhiteSpace && 60 | ((!prevIsPunctuation || prevIsExcepted) || nextIsWhiteSpace || nextIsPunctuation); 61 | 62 | if (!enableWithinWord) 63 | { 64 | var temp = canOpen; 65 | // A single _ character can open emphasis iff it is part of a left-flanking delimiter run and either 66 | // (a) not part of a right-flanking delimiter run or 67 | // (b) part of a right-flanking delimiter run preceded by punctuation. 68 | canOpen = canOpen && (!canClose || prevIsPunctuation); 69 | 70 | // A single _ character can close emphasis iff it is part of a right-flanking delimiter run and either 71 | // (a) not part of a left-flanking delimiter run or 72 | // (b) part of a left-flanking delimiter run followed by punctuation. 73 | canClose = canClose && (!temp || nextIsPunctuation); 74 | } 75 | } 76 | 77 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 78 | public static bool IsRomanLetterPartial(char c) 79 | { 80 | // We don't support LCDM 81 | return IsRomanLetterLowerPartial(c) || IsRomanLetterUpperPartial(c); 82 | } 83 | 84 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 85 | public static bool IsRomanLetterLowerPartial(char c) 86 | { 87 | // We don't support LCDM 88 | return c == 'i' || c == 'v' || c == 'x'; 89 | } 90 | 91 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 92 | public static bool IsRomanLetterUpperPartial(char c) 93 | { 94 | // We don't support LCDM 95 | return c == 'I' || c == 'V' || c == 'X'; 96 | } 97 | 98 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 99 | public static int RomanToArabic(ReadOnlySpan text) 100 | { 101 | int result = 0; 102 | for (int i = 0; i < text.Length; i++) 103 | { 104 | var candidate = romanMap[text[i]]; 105 | if ((uint)(i + 1) < text.Length && candidate < romanMap[text[i + 1]]) 106 | { 107 | result -= candidate; 108 | } 109 | else 110 | { 111 | result += candidate; 112 | } 113 | } 114 | return result; 115 | } 116 | 117 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 118 | public static int AddTab(int column) 119 | { 120 | // return ((column + TabSize) / TabSize) * TabSize; 121 | Debug.Assert(TabSize == 4, "Change the AddTab implementation if TabSize is no longer a power of 2"); 122 | return TabSize + (column & ~(TabSize - 1)); 123 | } 124 | 125 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 126 | public static bool IsAcrossTab(int column) 127 | { 128 | return (column & (TabSize - 1)) != 0; 129 | } 130 | 131 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 132 | public static bool Contains(this char[] charList, char c) 133 | { 134 | foreach (char ch in charList) 135 | { 136 | if (ch == c) 137 | { 138 | return true; 139 | } 140 | } 141 | return false; 142 | } 143 | 144 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 145 | public static bool IsWhitespace(this char c) 146 | { 147 | // 2.1 Characters and lines 148 | // A Unicode whitespace character is any code point in the Unicode Zs general category, 149 | // or a tab (U+0009), line feed (U+000A), form feed (U+000C), or carriage return (U+000D). 150 | if (c <= ' ') 151 | { 152 | const long Mask = 153 | (1L << ' ') | 154 | (1L << '\t') | 155 | (1L << '\n') | 156 | (1L << '\f') | 157 | (1L << '\r'); 158 | 159 | return (Mask & (1L << c)) != 0; 160 | } 161 | 162 | return c >= '\u00A0' && IsWhitespaceRare(c); 163 | 164 | static bool IsWhitespaceRare(char c) 165 | { 166 | // return CharUnicodeInfo.GetUnicodeCategory(c) == UnicodeCategory.SpaceSeparator; 167 | 168 | if (c < 5760) 169 | { 170 | return c == '\u00A0'; 171 | } 172 | else 173 | { 174 | return c <= 12288 && 175 | (c == 5760 || IsInInclusiveRange(c, 8192, 8202) || c == 8239 || c == 8287 || c == 12288); 176 | } 177 | } 178 | } 179 | 180 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 181 | public static bool IsControl(this char c) 182 | { 183 | return c < ' ' || char.IsControl(c); 184 | } 185 | 186 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 187 | public static bool IsEscapableSymbol(this char c) 188 | { 189 | // char.IsSymbol also works with Unicode symbols that cannot be escaped based on the specification. 190 | return (c > ' ' && c < '0') || (c > '9' && c < 'A') || (c > 'Z' && c < 'a') || (c > 'z' && c < 127) || c == '•'; 191 | } 192 | 193 | //[MethodImpl(MethodImplOptions.AggressiveInlining)] 194 | public static bool IsWhiteSpaceOrZero(this char c) 195 | { 196 | return IsZero(c) || IsWhitespace(c); 197 | } 198 | 199 | // Check if a char is a space or a punctuation 200 | public static void CheckUnicodeCategory(this char c, out bool space, out bool punctuation) 201 | { 202 | if (IsWhitespace(c)) 203 | { 204 | space = true; 205 | punctuation = false; 206 | } 207 | else if (c <= 127) 208 | { 209 | space = c == '\0'; 210 | punctuation = c == '\0' || IsAsciiPunctuation(c); 211 | } 212 | else 213 | { 214 | // A Unicode punctuation character is an ASCII punctuation character 215 | // or anything in the general Unicode categories Pc, Pd, Pe, Pf, Pi, Po, or Ps. 216 | space = false; 217 | UnicodeCategory category = CharUnicodeInfo.GetUnicodeCategory(c); 218 | punctuation = category == UnicodeCategory.ConnectorPunctuation 219 | || category == UnicodeCategory.DashPunctuation 220 | || category == UnicodeCategory.OpenPunctuation 221 | || category == UnicodeCategory.ClosePunctuation 222 | || category == UnicodeCategory.InitialQuotePunctuation 223 | || category == UnicodeCategory.FinalQuotePunctuation 224 | || category == UnicodeCategory.OtherPunctuation; 225 | } 226 | } 227 | 228 | // Same as CheckUnicodeCategory 229 | internal static bool IsSpaceOrPunctuation(this char c) 230 | { 231 | if (IsWhitespace(c)) 232 | { 233 | return true; 234 | } 235 | else if (c <= 127) 236 | { 237 | return c == '\0' || IsAsciiPunctuation(c); 238 | } 239 | else 240 | { 241 | var category = CharUnicodeInfo.GetUnicodeCategory(c); 242 | return category == UnicodeCategory.ConnectorPunctuation 243 | || category == UnicodeCategory.DashPunctuation 244 | || category == UnicodeCategory.OpenPunctuation 245 | || category == UnicodeCategory.ClosePunctuation 246 | || category == UnicodeCategory.InitialQuotePunctuation 247 | || category == UnicodeCategory.FinalQuotePunctuation 248 | || category == UnicodeCategory.OtherPunctuation; 249 | } 250 | } 251 | 252 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 253 | public static bool IsNewLineOrLineFeed(this char c) 254 | { 255 | return c == '\n' || c == '\r'; 256 | } 257 | 258 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 259 | public static bool IsZero(this char c) 260 | { 261 | return c == '\0'; 262 | } 263 | 264 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 265 | public static bool IsSpace(this char c) 266 | { 267 | // 2.1 Characters and lines 268 | // A space is U+0020. 269 | return c == ' '; 270 | } 271 | 272 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 273 | public static bool IsTab(this char c) 274 | { 275 | // 2.1 Characters and lines 276 | // A space is U+0009. 277 | return c == '\t'; 278 | } 279 | 280 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 281 | public static bool IsSpaceOrTab(this char c) 282 | { 283 | return IsSpace(c) || IsTab(c); 284 | } 285 | 286 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 287 | public static char EscapeInsecure(this char c) 288 | { 289 | // 2.3 Insecure characters 290 | // For security reasons, the Unicode character U+0000 must be replaced with the REPLACEMENT CHARACTER (U+FFFD). 291 | return c == '\0' ? '\ufffd' : c; 292 | } 293 | 294 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 295 | public static bool IsAlphaUpper(this char c) 296 | { 297 | return (uint)(c - 'A') <= ('Z' - 'A'); 298 | } 299 | 300 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 301 | public static bool IsAlpha(this char c) 302 | { 303 | return (uint)((c - 'A') & ~0x20) <= ('Z' - 'A'); 304 | } 305 | 306 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 307 | public static bool IsAlphaNumeric(this char c) 308 | { 309 | return IsAlpha(c) || IsDigit(c); 310 | } 311 | 312 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 313 | public static bool IsDigit(this char c) 314 | { 315 | return (uint)(c - '0') <= ('9' - '0'); 316 | } 317 | 318 | public static bool IsAsciiPunctuation(this char c) 319 | { 320 | // 2.1 Characters and lines 321 | // An ASCII punctuation character is 322 | // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., / (U+0021–2F), 323 | // :, ;, <, =, >, ?, @ (U+003A–0040), 324 | // [, \, ], ^, _, ` (U+005B–0060), 325 | // {, |, }, or ~ (U+007B–007E). 326 | return c <= 127 && ( 327 | IsInInclusiveRange(c, 33, 47) || 328 | IsInInclusiveRange(c, 58, 64) || 329 | IsInInclusiveRange(c, 91, 96) || 330 | IsInInclusiveRange(c, 123, 126)); 331 | } 332 | 333 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 334 | public static bool IsEmailUsernameSpecialChar(char c) 335 | { 336 | return ".!#$%&'*+/=?^_`{|}~-+.~".IndexOf(c) >= 0; 337 | } 338 | 339 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 340 | public static bool IsHighSurrogate(char c) 341 | { 342 | return IsInInclusiveRange(c, HighSurrogateStart, HighSurrogateEnd); 343 | } 344 | 345 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 346 | public static bool IsLowSurrogate(char c) 347 | { 348 | return IsInInclusiveRange(c, LowSurrogateStart, LowSurrogateEnd); 349 | } 350 | 351 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 352 | private static bool IsInInclusiveRange(char c, char min, char max) 353 | => (uint)(c - min) <= (uint)(max - min); 354 | 355 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 356 | internal static bool IsInInclusiveRange(int value, uint min, uint max) 357 | => ((uint)value - min) <= (max - min); 358 | 359 | public static bool IsRightToLeft(int c) 360 | { 361 | // Generated from Table D.1 of RFC3454 362 | // http://www.ietf.org/rfc/rfc3454.txt 363 | 364 | // Probably should use a binary search approach 365 | 366 | return c >= 0x0005D0 && c <= 0x0005EA || 367 | c >= 0x0005F0 && c <= 0x0005F4 || 368 | c >= 0x000621 && c <= 0x00063A || 369 | c >= 0x000640 && c <= 0x00064A || 370 | c >= 0x00066D && c <= 0x00066F || 371 | c >= 0x000671 && c <= 0x0006D5 || 372 | c >= 0x0006E5 && c <= 0x0006E6 || 373 | c >= 0x0006FA && c <= 0x0006FE || 374 | c >= 0x000700 && c <= 0x00070D || 375 | c >= 0x000712 && c <= 0x00072C || 376 | c >= 0x000780 && c <= 0x0007A5 || 377 | c >= 0x00FB1F && c <= 0x00FB28 || 378 | c >= 0x00FB2A && c <= 0x00FB36 || 379 | c >= 0x00FB38 && c <= 0x00FB3C || 380 | c >= 0x00FB40 && c <= 0x00FB41 || 381 | c >= 0x00FB43 && c <= 0x00FB44 || 382 | c >= 0x00FB46 && c <= 0x00FBB1 || 383 | c >= 0x00FBD3 && c <= 0x00FD3D || 384 | c >= 0x00FD50 && c <= 0x00FD8F || 385 | c >= 0x00FD92 && c <= 0x00FDC7 || 386 | c >= 0x00FDF0 && c <= 0x00FDFC || 387 | c >= 0x00FE70 && c <= 0x00FE74 || 388 | c >= 0x00FE76 && c <= 0x00FEFC || 389 | c == 0x0005BE || c == 0x0005C0 || 390 | c == 0x0005C3 || c == 0x00061B || 391 | c == 0x00061F || c == 0x0006DD || 392 | c == 0x000710 || c == 0x0007B1 || 393 | c == 0x00200F || c == 0x00FB1D || 394 | c == 0x00FB3E; 395 | } 396 | 397 | public static bool IsLeftToRight(int c) 398 | { 399 | // Generated from Table D.2 of RFC3454 400 | // http://www.ietf.org/rfc/rfc3454.txt 401 | 402 | // Probably should use a binary search approach 403 | 404 | return c >= 0x000041 && c <= 0x00005A || 405 | c >= 0x000061 && c <= 0x00007A || 406 | c >= 0x0000C0 && c <= 0x0000D6 || 407 | c >= 0x0000D8 && c <= 0x0000F6 || 408 | c >= 0x0000F8 && c <= 0x000220 || 409 | c >= 0x000222 && c <= 0x000233 || 410 | c >= 0x000250 && c <= 0x0002AD || 411 | c >= 0x0002B0 && c <= 0x0002B8 || 412 | c >= 0x0002BB && c <= 0x0002C1 || 413 | c >= 0x0002D0 && c <= 0x0002D1 || 414 | c >= 0x0002E0 && c <= 0x0002E4 || 415 | c >= 0x000388 && c <= 0x00038A || 416 | c >= 0x00038E && c <= 0x0003A1 || 417 | c >= 0x0003A3 && c <= 0x0003CE || 418 | c >= 0x0003D0 && c <= 0x0003F5 || 419 | c >= 0x000400 && c <= 0x000482 || 420 | c >= 0x00048A && c <= 0x0004CE || 421 | c >= 0x0004D0 && c <= 0x0004F5 || 422 | c >= 0x0004F8 && c <= 0x0004F9 || 423 | c >= 0x000500 && c <= 0x00050F || 424 | c >= 0x000531 && c <= 0x000556 || 425 | c >= 0x000559 && c <= 0x00055F || 426 | c >= 0x000561 && c <= 0x000587 || 427 | c >= 0x000905 && c <= 0x000939 || 428 | c >= 0x00093D && c <= 0x000940 || 429 | c >= 0x000949 && c <= 0x00094C || 430 | c >= 0x000958 && c <= 0x000961 || 431 | c >= 0x000964 && c <= 0x000970 || 432 | c >= 0x000982 && c <= 0x000983 || 433 | c >= 0x000985 && c <= 0x00098C || 434 | c >= 0x00098F && c <= 0x000990 || 435 | c >= 0x000993 && c <= 0x0009A8 || 436 | c >= 0x0009AA && c <= 0x0009B0 || 437 | c >= 0x0009B6 && c <= 0x0009B9 || 438 | c >= 0x0009BE && c <= 0x0009C0 || 439 | c >= 0x0009C7 && c <= 0x0009C8 || 440 | c >= 0x0009CB && c <= 0x0009CC || 441 | c >= 0x0009DC && c <= 0x0009DD || 442 | c >= 0x0009DF && c <= 0x0009E1 || 443 | c >= 0x0009E6 && c <= 0x0009F1 || 444 | c >= 0x0009F4 && c <= 0x0009FA || 445 | c >= 0x000A05 && c <= 0x000A0A || 446 | c >= 0x000A0F && c <= 0x000A10 || 447 | c >= 0x000A13 && c <= 0x000A28 || 448 | c >= 0x000A2A && c <= 0x000A30 || 449 | c >= 0x000A32 && c <= 0x000A33 || 450 | c >= 0x000A35 && c <= 0x000A36 || 451 | c >= 0x000A38 && c <= 0x000A39 || 452 | c >= 0x000A3E && c <= 0x000A40 || 453 | c >= 0x000A59 && c <= 0x000A5C || 454 | c >= 0x000A66 && c <= 0x000A6F || 455 | c >= 0x000A72 && c <= 0x000A74 || 456 | c >= 0x000A85 && c <= 0x000A8B || 457 | c >= 0x000A8F && c <= 0x000A91 || 458 | c >= 0x000A93 && c <= 0x000AA8 || 459 | c >= 0x000AAA && c <= 0x000AB0 || 460 | c >= 0x000AB2 && c <= 0x000AB3 || 461 | c >= 0x000AB5 && c <= 0x000AB9 || 462 | c >= 0x000ABD && c <= 0x000AC0 || 463 | c >= 0x000ACB && c <= 0x000ACC || 464 | c >= 0x000AE6 && c <= 0x000AEF || 465 | c >= 0x000B02 && c <= 0x000B03 || 466 | c >= 0x000B05 && c <= 0x000B0C || 467 | c >= 0x000B0F && c <= 0x000B10 || 468 | c >= 0x000B13 && c <= 0x000B28 || 469 | c >= 0x000B2A && c <= 0x000B30 || 470 | c >= 0x000B32 && c <= 0x000B33 || 471 | c >= 0x000B36 && c <= 0x000B39 || 472 | c >= 0x000B3D && c <= 0x000B3E || 473 | c >= 0x000B47 && c <= 0x000B48 || 474 | c >= 0x000B4B && c <= 0x000B4C || 475 | c >= 0x000B5C && c <= 0x000B5D || 476 | c >= 0x000B5F && c <= 0x000B61 || 477 | c >= 0x000B66 && c <= 0x000B70 || 478 | c >= 0x000B85 && c <= 0x000B8A || 479 | c >= 0x000B8E && c <= 0x000B90 || 480 | c >= 0x000B92 && c <= 0x000B95 || 481 | c >= 0x000B99 && c <= 0x000B9A || 482 | c >= 0x000B9E && c <= 0x000B9F || 483 | c >= 0x000BA3 && c <= 0x000BA4 || 484 | c >= 0x000BA8 && c <= 0x000BAA || 485 | c >= 0x000BAE && c <= 0x000BB5 || 486 | c >= 0x000BB7 && c <= 0x000BB9 || 487 | c >= 0x000BBE && c <= 0x000BBF || 488 | c >= 0x000BC1 && c <= 0x000BC2 || 489 | c >= 0x000BC6 && c <= 0x000BC8 || 490 | c >= 0x000BCA && c <= 0x000BCC || 491 | c >= 0x000BE7 && c <= 0x000BF2 || 492 | c >= 0x000C01 && c <= 0x000C03 || 493 | c >= 0x000C05 && c <= 0x000C0C || 494 | c >= 0x000C0E && c <= 0x000C10 || 495 | c >= 0x000C12 && c <= 0x000C28 || 496 | c >= 0x000C2A && c <= 0x000C33 || 497 | c >= 0x000C35 && c <= 0x000C39 || 498 | c >= 0x000C41 && c <= 0x000C44 || 499 | c >= 0x000C60 && c <= 0x000C61 || 500 | c >= 0x000C66 && c <= 0x000C6F || 501 | c >= 0x000C82 && c <= 0x000C83 || 502 | c >= 0x000C85 && c <= 0x000C8C || 503 | c >= 0x000C8E && c <= 0x000C90 || 504 | c >= 0x000C92 && c <= 0x000CA8 || 505 | c >= 0x000CAA && c <= 0x000CB3 || 506 | c >= 0x000CB5 && c <= 0x000CB9 || 507 | c >= 0x000CC0 && c <= 0x000CC4 || 508 | c >= 0x000CC7 && c <= 0x000CC8 || 509 | c >= 0x000CCA && c <= 0x000CCB || 510 | c >= 0x000CD5 && c <= 0x000CD6 || 511 | c >= 0x000CE0 && c <= 0x000CE1 || 512 | c >= 0x000CE6 && c <= 0x000CEF || 513 | c >= 0x000D02 && c <= 0x000D03 || 514 | c >= 0x000D05 && c <= 0x000D0C || 515 | c >= 0x000D0E && c <= 0x000D10 || 516 | c >= 0x000D12 && c <= 0x000D28 || 517 | c >= 0x000D2A && c <= 0x000D39 || 518 | c >= 0x000D3E && c <= 0x000D40 || 519 | c >= 0x000D46 && c <= 0x000D48 || 520 | c >= 0x000D4A && c <= 0x000D4C || 521 | c >= 0x000D60 && c <= 0x000D61 || 522 | c >= 0x000D66 && c <= 0x000D6F || 523 | c >= 0x000D82 && c <= 0x000D83 || 524 | c >= 0x000D85 && c <= 0x000D96 || 525 | c >= 0x000D9A && c <= 0x000DB1 || 526 | c >= 0x000DB3 && c <= 0x000DBB || 527 | c >= 0x000DC0 && c <= 0x000DC6 || 528 | c >= 0x000DCF && c <= 0x000DD1 || 529 | c >= 0x000DD8 && c <= 0x000DDF || 530 | c >= 0x000DF2 && c <= 0x000DF4 || 531 | c >= 0x000E01 && c <= 0x000E30 || 532 | c >= 0x000E32 && c <= 0x000E33 || 533 | c >= 0x000E40 && c <= 0x000E46 || 534 | c >= 0x000E4F && c <= 0x000E5B || 535 | c >= 0x000E81 && c <= 0x000E82 || 536 | c >= 0x000E87 && c <= 0x000E88 || 537 | c >= 0x000E94 && c <= 0x000E97 || 538 | c >= 0x000E99 && c <= 0x000E9F || 539 | c >= 0x000EA1 && c <= 0x000EA3 || 540 | c >= 0x000EAA && c <= 0x000EAB || 541 | c >= 0x000EAD && c <= 0x000EB0 || 542 | c >= 0x000EB2 && c <= 0x000EB3 || 543 | c >= 0x000EC0 && c <= 0x000EC4 || 544 | c >= 0x000ED0 && c <= 0x000ED9 || 545 | c >= 0x000EDC && c <= 0x000EDD || 546 | c >= 0x000F00 && c <= 0x000F17 || 547 | c >= 0x000F1A && c <= 0x000F34 || 548 | c >= 0x000F3E && c <= 0x000F47 || 549 | c >= 0x000F49 && c <= 0x000F6A || 550 | c >= 0x000F88 && c <= 0x000F8B || 551 | c >= 0x000FBE && c <= 0x000FC5 || 552 | c >= 0x000FC7 && c <= 0x000FCC || 553 | c >= 0x001000 && c <= 0x001021 || 554 | c >= 0x001023 && c <= 0x001027 || 555 | c >= 0x001029 && c <= 0x00102A || 556 | c >= 0x001040 && c <= 0x001057 || 557 | c >= 0x0010A0 && c <= 0x0010C5 || 558 | c >= 0x0010D0 && c <= 0x0010F8 || 559 | c >= 0x001100 && c <= 0x001159 || 560 | c >= 0x00115F && c <= 0x0011A2 || 561 | c >= 0x0011A8 && c <= 0x0011F9 || 562 | c >= 0x001200 && c <= 0x001206 || 563 | c >= 0x001208 && c <= 0x001246 || 564 | c >= 0x00124A && c <= 0x00124D || 565 | c >= 0x001250 && c <= 0x001256 || 566 | c >= 0x00125A && c <= 0x00125D || 567 | c >= 0x001260 && c <= 0x001286 || 568 | c >= 0x00128A && c <= 0x00128D || 569 | c >= 0x001290 && c <= 0x0012AE || 570 | c >= 0x0012B2 && c <= 0x0012B5 || 571 | c >= 0x0012B8 && c <= 0x0012BE || 572 | c >= 0x0012C2 && c <= 0x0012C5 || 573 | c >= 0x0012C8 && c <= 0x0012CE || 574 | c >= 0x0012D0 && c <= 0x0012D6 || 575 | c >= 0x0012D8 && c <= 0x0012EE || 576 | c >= 0x0012F0 && c <= 0x00130E || 577 | c >= 0x001312 && c <= 0x001315 || 578 | c >= 0x001318 && c <= 0x00131E || 579 | c >= 0x001320 && c <= 0x001346 || 580 | c >= 0x001348 && c <= 0x00135A || 581 | c >= 0x001361 && c <= 0x00137C || 582 | c >= 0x0013A0 && c <= 0x0013F4 || 583 | c >= 0x001401 && c <= 0x001676 || 584 | c >= 0x001681 && c <= 0x00169A || 585 | c >= 0x0016A0 && c <= 0x0016F0 || 586 | c >= 0x001700 && c <= 0x00170C || 587 | c >= 0x00170E && c <= 0x001711 || 588 | c >= 0x001720 && c <= 0x001731 || 589 | c >= 0x001735 && c <= 0x001736 || 590 | c >= 0x001740 && c <= 0x001751 || 591 | c >= 0x001760 && c <= 0x00176C || 592 | c >= 0x00176E && c <= 0x001770 || 593 | c >= 0x001780 && c <= 0x0017B6 || 594 | c >= 0x0017BE && c <= 0x0017C5 || 595 | c >= 0x0017C7 && c <= 0x0017C8 || 596 | c >= 0x0017D4 && c <= 0x0017DA || 597 | c >= 0x0017E0 && c <= 0x0017E9 || 598 | c >= 0x001810 && c <= 0x001819 || 599 | c >= 0x001820 && c <= 0x001877 || 600 | c >= 0x001880 && c <= 0x0018A8 || 601 | c >= 0x001E00 && c <= 0x001E9B || 602 | c >= 0x001EA0 && c <= 0x001EF9 || 603 | c >= 0x001F00 && c <= 0x001F15 || 604 | c >= 0x001F18 && c <= 0x001F1D || 605 | c >= 0x001F20 && c <= 0x001F45 || 606 | c >= 0x001F48 && c <= 0x001F4D || 607 | c >= 0x001F50 && c <= 0x001F57 || 608 | c >= 0x001F5F && c <= 0x001F7D || 609 | c >= 0x001F80 && c <= 0x001FB4 || 610 | c >= 0x001FB6 && c <= 0x001FBC || 611 | c >= 0x001FC2 && c <= 0x001FC4 || 612 | c >= 0x001FC6 && c <= 0x001FCC || 613 | c >= 0x001FD0 && c <= 0x001FD3 || 614 | c >= 0x001FD6 && c <= 0x001FDB || 615 | c >= 0x001FE0 && c <= 0x001FEC || 616 | c >= 0x001FF2 && c <= 0x001FF4 || 617 | c >= 0x001FF6 && c <= 0x001FFC || 618 | c >= 0x00210A && c <= 0x002113 || 619 | c >= 0x002119 && c <= 0x00211D || 620 | c >= 0x00212A && c <= 0x00212D || 621 | c >= 0x00212F && c <= 0x002131 || 622 | c >= 0x002133 && c <= 0x002139 || 623 | c >= 0x00213D && c <= 0x00213F || 624 | c >= 0x002145 && c <= 0x002149 || 625 | c >= 0x002160 && c <= 0x002183 || 626 | c >= 0x002336 && c <= 0x00237A || 627 | c >= 0x00249C && c <= 0x0024E9 || 628 | c >= 0x003005 && c <= 0x003007 || 629 | c >= 0x003021 && c <= 0x003029 || 630 | c >= 0x003031 && c <= 0x003035 || 631 | c >= 0x003038 && c <= 0x00303C || 632 | c >= 0x003041 && c <= 0x003096 || 633 | c >= 0x00309D && c <= 0x00309F || 634 | c >= 0x0030A1 && c <= 0x0030FA || 635 | c >= 0x0030FC && c <= 0x0030FF || 636 | c >= 0x003105 && c <= 0x00312C || 637 | c >= 0x003131 && c <= 0x00318E || 638 | c >= 0x003190 && c <= 0x0031B7 || 639 | c >= 0x0031F0 && c <= 0x00321C || 640 | c >= 0x003220 && c <= 0x003243 || 641 | c >= 0x003260 && c <= 0x00327B || 642 | c >= 0x00327F && c <= 0x0032B0 || 643 | c >= 0x0032C0 && c <= 0x0032CB || 644 | c >= 0x0032D0 && c <= 0x0032FE || 645 | c >= 0x003300 && c <= 0x003376 || 646 | c >= 0x00337B && c <= 0x0033DD || 647 | c >= 0x0033E0 && c <= 0x0033FE || 648 | c >= 0x003400 && c <= 0x004DB5 || 649 | c >= 0x004E00 && c <= 0x009FA5 || 650 | c >= 0x00A000 && c <= 0x00A48C || 651 | c >= 0x00AC00 && c <= 0x00D7A3 || 652 | c >= 0x00D800 && c <= 0x00FA2D || 653 | c >= 0x00FA30 && c <= 0x00FA6A || 654 | c >= 0x00FB00 && c <= 0x00FB06 || 655 | c >= 0x00FB13 && c <= 0x00FB17 || 656 | c >= 0x00FF21 && c <= 0x00FF3A || 657 | c >= 0x00FF41 && c <= 0x00FF5A || 658 | c >= 0x00FF66 && c <= 0x00FFBE || 659 | c >= 0x00FFC2 && c <= 0x00FFC7 || 660 | c >= 0x00FFCA && c <= 0x00FFCF || 661 | c >= 0x00FFD2 && c <= 0x00FFD7 || 662 | c >= 0x00FFDA && c <= 0x00FFDC || 663 | c >= 0x010300 && c <= 0x01031E || 664 | c >= 0x010320 && c <= 0x010323 || 665 | c >= 0x010330 && c <= 0x01034A || 666 | c >= 0x010400 && c <= 0x010425 || 667 | c >= 0x010428 && c <= 0x01044D || 668 | c >= 0x01D000 && c <= 0x01D0F5 || 669 | c >= 0x01D100 && c <= 0x01D126 || 670 | c >= 0x01D12A && c <= 0x01D166 || 671 | c >= 0x01D16A && c <= 0x01D172 || 672 | c >= 0x01D183 && c <= 0x01D184 || 673 | c >= 0x01D18C && c <= 0x01D1A9 || 674 | c >= 0x01D1AE && c <= 0x01D1DD || 675 | c >= 0x01D400 && c <= 0x01D454 || 676 | c >= 0x01D456 && c <= 0x01D49C || 677 | c >= 0x01D49E && c <= 0x01D49F || 678 | c >= 0x01D4A5 && c <= 0x01D4A6 || 679 | c >= 0x01D4A9 && c <= 0x01D4AC || 680 | c >= 0x01D4AE && c <= 0x01D4B9 || 681 | c >= 0x01D4BD && c <= 0x01D4C0 || 682 | c >= 0x01D4C2 && c <= 0x01D4C3 || 683 | c >= 0x01D4C5 && c <= 0x01D505 || 684 | c >= 0x01D507 && c <= 0x01D50A || 685 | c >= 0x01D50D && c <= 0x01D514 || 686 | c >= 0x01D516 && c <= 0x01D51C || 687 | c >= 0x01D51E && c <= 0x01D539 || 688 | c >= 0x01D53B && c <= 0x01D53E || 689 | c >= 0x01D540 && c <= 0x01D544 || 690 | c >= 0x01D54A && c <= 0x01D550 || 691 | c >= 0x01D552 && c <= 0x01D6A3 || 692 | c >= 0x01D6A8 && c <= 0x01D7C9 || 693 | c >= 0x020000 && c <= 0x02A6D6 || 694 | c >= 0x02F800 && c <= 0x02FA1D || 695 | c >= 0x0F0000 && c <= 0x0FFFFD || 696 | c >= 0x100000 && c <= 0x10FFFD || 697 | c == 0x0000AA || c == 0x0000B5 || 698 | c == 0x0000BA || c == 0x0002EE || 699 | c == 0x00037A || c == 0x000386 || 700 | c == 0x00038C || c == 0x000589 || 701 | c == 0x000903 || c == 0x000950 || 702 | c == 0x0009B2 || c == 0x0009D7 || 703 | c == 0x000A5E || c == 0x000A83 || 704 | c == 0x000A8D || c == 0x000AC9 || 705 | c == 0x000AD0 || c == 0x000AE0 || 706 | c == 0x000B40 || c == 0x000B57 || 707 | c == 0x000B83 || c == 0x000B9C || 708 | c == 0x000BD7 || c == 0x000CBE || 709 | c == 0x000CDE || c == 0x000D57 || 710 | c == 0x000DBD || c == 0x000E84 || 711 | c == 0x000E8A || c == 0x000E8D || 712 | c == 0x000EA5 || c == 0x000EA7 || 713 | c == 0x000EBD || c == 0x000EC6 || 714 | c == 0x000F36 || c == 0x000F38 || 715 | c == 0x000F7F || c == 0x000F85 || 716 | c == 0x000FCF || c == 0x00102C || 717 | c == 0x001031 || c == 0x001038 || 718 | c == 0x0010FB || c == 0x001248 || 719 | c == 0x001258 || c == 0x001288 || 720 | c == 0x0012B0 || c == 0x0012C0 || 721 | c == 0x001310 || c == 0x0017DC || 722 | c == 0x001F59 || c == 0x001F5B || 723 | c == 0x001F5D || c == 0x001FBE || 724 | c == 0x00200E || c == 0x002071 || 725 | c == 0x00207F || c == 0x002102 || 726 | c == 0x002107 || c == 0x002115 || 727 | c == 0x002124 || c == 0x002126 || 728 | c == 0x002128 || c == 0x002395 || 729 | c == 0x01D4A2 || c == 0x01D4BB || 730 | c == 0x01D546; 731 | } 732 | 733 | // Used by ListExtraItemParser to format numbers from 1 - 26 734 | private static readonly string[] smallNumberStringCache = { 735 | "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", 736 | "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", 737 | "20", "21", "22", "23", "24", "25", "26", 738 | }; 739 | 740 | internal static string SmallNumberToString(int number) 741 | { 742 | string[] cache = smallNumberStringCache; 743 | if ((uint)number < (uint)cache.Length) 744 | { 745 | return cache[number]; 746 | } 747 | 748 | return number.ToString(CultureInfo.InvariantCulture); 749 | } 750 | } 751 | } --------------------------------------------------------------------------------