Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hex colors detection #59

Merged
merged 8 commits into from
May 8, 2022
Merged

Add hex colors detection #59

merged 8 commits into from
May 8, 2022

Conversation

RblSb
Copy link
Member

@RblSb RblSb commented May 5, 2022

Works out of box it seems. Please bind with vscode option by yourself, i have no idea about correct server handling. Some description suggestion:

"haxe.enableColorsDetection": {
	"type": "boolean",
	"default": true,
	"markdownDescription": "Try to detect `0xAA/RRGGBB` colors in code and show color pickers"
}

(also null access fix for updateActiveEditorPackage)

@Gama11
Copy link
Member

Gama11 commented May 5, 2022

image

… into palette

# Conflicts:
#	src/haxeLanguageServer/documents/HxTextDocument.hx
@RblSb
Copy link
Member Author

RblSb commented May 5, 2022

Sigh, i dont know how to compile this after merge/rebase and npm install.
image

@AlexHaxe
Copy link
Member

AlexHaxe commented May 5, 2022

Sigh, i dont know how to compile this after merge/rebase and npm install. image

did you perform a lix download?

edit: also I had to rename languageserver's TextDocument to HxTextDocument to avoid name clashes with TextDocument type from externs

@RblSb
Copy link
Member Author

RblSb commented May 5, 2022

Yes (also called from npm postinstall), this is all i get now:

/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
/vshaxe/server/src/haxeLanguageServer/import.hx:6: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
server/shared/haxeLanguageServer/LanguageServerMethods.hx:5: characters 8-56 : Type not found : languageServerProtocol.textdocument.TextDocument
server/shared/haxeLanguageServer/LanguageServerMethods.hx:41: characters 76-87 : Type not found : DocumentUri

There is ~/haxe/haxe_libraries/language-server-protocol/3.17.0-rc.20/github/55bb2720c6d728b4e4d4ad49bb2a069add8f6438/src/languageServerProtocol/textdocument/TextDocument.hx

@RblSb
Copy link
Member Author

RblSb commented May 5, 2022

npx lix run vshaxe-build -t language-server -t language-server-tests shows same error as CI (still hard to fix with broken ide, will try to redownload repo tomorrow and copy branch code, idk)
npx lix run vshaxe-build -t vshaxe --debug shows same TextDocument error from outside (on this and on main branches).

@AlexHaxe
Copy link
Member

AlexHaxe commented May 5, 2022

it seems like you are running everything from vshaxe project.
I haven't updated vshaxe's dependencies, so it still uses 3.15.3 of language server protocol, while haxe-languageserver expects 3.17.0.

@RblSb
Copy link
Member Author

RblSb commented May 5, 2022

Thanks, with opened subproject things are working.

@RblSb
Copy link
Member Author

RblSb commented May 6, 2022

There is editor.colorDecorators setting btw, not sure if specific haxe option is required, if there is "[haxe]": {"editor.colorDecorators": false}. Maybe can be annoying for someone to disable this way.

@Gama11
Copy link
Member

Gama11 commented May 6, 2022

No, we don't want to add a redundant setting if it can be done with a built-in one.

@AlexHaxe
Copy link
Member

AlexHaxe commented May 6, 2022

both (global and Haxe specific) setting work fine according to my quick tests.
so... we good to merge?

@Gama11
Copy link
Member

Gama11 commented May 8, 2022

I haven't updated vshaxe's dependencies, so it still uses 3.15.3 of language server protocol, while haxe-languageserver expects 3.17.0.

Why not? They should be kept in sync, otherwise you can't build vshaxe with a current server version...

@Gama11
Copy link
Member

Gama11 commented May 8, 2022

@RblSb I noticed that we turn lowercase hex into uppercase hex in the color editor. We should try to preserve casing if possible.

@RblSb
Copy link
Member Author

RblSb commented May 8, 2022

Do you want to keep casing for every character or only low/high new string case based on first character after 0x?

@Gama11
Copy link
Member

Gama11 commented May 8, 2022

Good question, not sure about mixed casing... I don't think you even can fully preserve casing there, after all, a position that was previously a number might turn into a letter after changing the color in the editor, and then you have nothing to base the decision on. So it's probably best to base it on the first letter.

0x00112233 is detected as uppercase
@Gama11 Gama11 merged commit ac07576 into vshaxe:master May 8, 2022
@RblSb RblSb deleted the palette branch May 8, 2022 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants