Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

add OtherAlpabetic chars to Unicode completion #972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/autocomplete-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fuzzaldrinPlus = require('fuzzaldrin-plus')

const ProviderManager = require('./provider-manager')
const SuggestionList = require('./suggestion-list')
const {UnicodeLetters} = require('./unicode-helpers')
const {UnicodeAlpha} = require('./unicode-helpers')
const getAdditionalWordCharacters = require('./get-additional-word-characters')

const wordCharacterRegexCache = new Map()
Expand Down Expand Up @@ -57,8 +57,8 @@ class AutocompleteManager {

this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', enableExtendedUnicodeSupport => {
if (enableExtendedUnicodeSupport) {
this.prefixRegex = new RegExp(`(['"~\`!@#\\$%^&*\\(\\)\\{\\}\\[\\]=+,/\\?>])?(([${UnicodeLetters}\\d_]+[${UnicodeLetters}\\d_-]*)|([.:;[{(< ]+))$`)
this.wordPrefixRegex = new RegExp(`^[${UnicodeLetters}\\d_]+[${UnicodeLetters}\\d_-]*$`)
this.prefixRegex = new RegExp(`(['"~\`!@#\\$%^&*\\(\\)\\{\\}\\[\\]=+,/\\?>])?(([${UnicodeAlpha}\\d_]+[${UnicodeAlpha}\\d_-]*)|([.:;[{(< ]+))$`)
this.wordPrefixRegex = new RegExp(`^[${UnicodeAlpha}\\d_]+[${UnicodeAlpha}\\d_-]*$`)
} else {
this.prefixRegex = /(\b|['"~`!@#$%^&*(){}[\]=+,/?>])((\w+[\w-]*)|([.:;[{(< ]+))$/
this.wordPrefixRegex = /^\w+[\w-]*$/
Expand Down Expand Up @@ -510,7 +510,7 @@ See https://github.com/atom/autocomplete-plus/wiki/Provider-API`
let regex = wordCharacterRegexCache.get(additionalWordChars)

if (!regex) {
regex = new RegExp(`[${UnicodeLetters}${additionalWordChars.replace(']', '\\]')}]`)
regex = new RegExp(`[${UnicodeAlpha}${additionalWordChars.replace(']', '\\]')}]`)
wordCharacterRegexCache.set(additionalWordChars, regex)
}
return regex
Expand Down
4 changes: 2 additions & 2 deletions lib/suggestion-list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {Emitter, CompositeDisposable} = require('atom')
const { UnicodeLetters } = require('./unicode-helpers')
const { UnicodeAlpha } = require('./unicode-helpers')
const SuggestionListElement = require('./suggestion-list-element')

module.exports =
Expand Down Expand Up @@ -29,7 +29,7 @@ class SuggestionList {
}))
this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', (enableExtendedUnicodeSupport) => {
if (enableExtendedUnicodeSupport) {
this.wordPrefixRegex = new RegExp(`^[${UnicodeLetters}\\d_-]`)
this.wordPrefixRegex = new RegExp(`^[${UnicodeAlpha}\\d_-]`)
} else {
this.wordPrefixRegex = /^[\w-]/
}
Expand Down
8 changes: 4 additions & 4 deletions lib/symbol-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import _ from 'underscore-plus'
import { CompositeDisposable } from 'atom'
import { Selector } from 'selector-kit'
import { UnicodeLetters } from './unicode-helpers'
import { UnicodeAlpha } from './unicode-helpers'
import SymbolStore from './symbol-store'

export default class SymbolProvider {
Expand All @@ -13,9 +13,9 @@ export default class SymbolProvider {
this.subscriptions = new CompositeDisposable()
this.subscriptions.add(atom.config.observe('autocomplete-plus.enableExtendedUnicodeSupport', enableExtendedUnicodeSupport => {
if (enableExtendedUnicodeSupport) {
this.wordRegex = new RegExp(`[${UnicodeLetters}\\d_]*[${UnicodeLetters}}_-]+[${UnicodeLetters}}\\d_]*(?=[^${UnicodeLetters}\\d_]|$)`, 'g')
this.beginningOfLineWordRegex = new RegExp(`^[${UnicodeLetters}\\d_]*[${UnicodeLetters}_-]+[${UnicodeLetters}\\d_]*(?=[^${UnicodeLetters}\\d_]|$)`, 'g')
this.endOfLineWordRegex = new RegExp(`[${UnicodeLetters}\\d_]*[${UnicodeLetters}_-]+[${UnicodeLetters}\\d_]*$`, 'g')
this.wordRegex = new RegExp(`[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}}_-]+[${UnicodeAlpha}}\\d_]*(?=[^${UnicodeAlpha}\\d_]|$)`, 'g')
this.beginningOfLineWordRegex = new RegExp(`^[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}_-]+[${UnicodeAlpha}\\d_]*(?=[^${UnicodeAlpha}\\d_]|$)`, 'g')
this.endOfLineWordRegex = new RegExp(`[${UnicodeAlpha}\\d_]*[${UnicodeAlpha}_-]+[${UnicodeAlpha}\\d_]*$`, 'g')
} else {
this.wordRegex = /\b\w*[a-zA-Z_-]+\w*\b/g
this.beginningOfLineWordRegex = /^\w*[a-zA-Z_-]+\w*\b/g
Expand Down
7 changes: 6 additions & 1 deletion lib/unicode-helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.