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

Version 0.4.0 #5

Merged
merged 35 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d9ee49c
Added css-tree and types
thechriskent Feb 29, 2024
28327d3
Initial Style Element Support!
thechriskent Feb 29, 2024
9aab72d
added htmlWithStyleElement test
thechriskent Feb 29, 2024
aac5f50
Prep for 0.3.0 release
thechriskent Feb 29, 2024
2c1d184
Merge pull request #3 from thechriskent/Style-Elements
thechriskent Apr 13, 2024
78a98e2
Initial HorseScript Definition
thechriskent Apr 19, 2024
99beb5f
Added meta.embedded scope
thechriskent Apr 19, 2024
231c06b
Standardized configuration file name
thechriskent Apr 19, 2024
ae83207
Update horsescript-language-configuration.json
thechriskent Apr 19, 2024
5c48862
Repository pattern reorganization
thechriskent Apr 19, 2024
b048508
horsescript syntax test files
thechriskent Apr 20, 2024
0cdb662
magicstrings and initial field subprops
thechriskent Apr 20, 2024
f941526
Field accessor Sub Props! Wowee!
thechriskent Apr 20, 2024
ba0543b
Field Metadata Sub Prop
thechriskent Apr 20, 2024
9191f45
Removed old fieldmetadata section
thechriskent Apr 20, 2024
760b658
Operators!
thechriskent Apr 20, 2024
a057fe0
Functions!
thechriskent Apr 20, 2024
a13aa3f
Initial class mapping
thechriskent Apr 20, 2024
d9dc524
More classes!
thechriskent Apr 20, 2024
8ec1dbe
A Heck Ton of more classes
thechriskent Apr 20, 2024
0565386
Magic String Magic!
thechriskent Apr 21, 2024
2a7114b
fieldsubprop stuff
thechriskent Apr 21, 2024
4bddc0d
Field Value Ship Shape
thechriskent Apr 21, 2024
63dc2aa
Yes/No matching
thechriskent Apr 21, 2024
7fe5ac2
Basic Theme with Token Support
thechriskent Apr 21, 2024
97a49b4
Added Watcher for Theme Generation
thechriskent Apr 21, 2024
0016b18
Initial Theme Token Mapping
thechriskent Apr 21, 2024
70abd04
Color Values
thechriskent Apr 21, 2024
c45990f
Recognizes negative numbers
thechriskent Apr 22, 2024
271239e
Multi-token file support
thechriskent Apr 22, 2024
3eafa1f
Dark Theme!
thechriskent Apr 22, 2024
5349985
Light Theme
thechriskent Apr 22, 2024
7e47c76
File rename
thechriskent Apr 30, 2024
7a8788c
Details for version 0.4.0
thechriskent Apr 30, 2024
1d0ba4f
Merge pull request #4 from thechriskent/neigh
thechriskent Apr 30, 2024
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
Prev Previous commit
Next Next commit
Initial Style Element Support!
  • Loading branch information
thechriskent committed Feb 29, 2024
commit 28327d3fa6be503fd08ef3bc0f79f1053bed119b
22 changes: 14 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as vscode from 'vscode';
import HTMLToSPFormat from './helpers/toFormat';
import ITransformResult, { transformResultMessageToString } from './models/ITransformResult';

export function activate(context: vscode.ExtensionContext) {

const outputChannel = vscode.window.createOutputChannel('JSONify');

/**
* Creates a new editor with the given content and language
* @param content the content to be displayed in the new editor
Expand All @@ -22,25 +25,26 @@ export function activate(context: vscode.ExtensionContext) {
*/
const toFormatFull = async (content: string, textEditor?: vscode.TextEditor): Promise<vscode.TextEditor | undefined> => {
let errorShown = false;
let json: string ='';
let result: ITransformResult | undefined;
try {
const result = await HTMLToSPFormat(content);
json = result.format;
result = await HTMLToSPFormat(content);
} catch (error) {
if(typeof textEditor === 'undefined'){
vscode.window.showErrorMessage('Unable to covert to SP format 😢: ' + error);
errorShown = true;
}// else swallow the error and keep the current editor content
}
try {
if(typeof json !== "undefined" && json.length > 0) {
if(typeof result !== "undefined" && typeof result.format !== "undefined" && result.format.length > 0) {
outputChannel.clear();
result?.messages.forEach((message) => {
outputChannel.appendLine(transformResultMessageToString(message));
});
if (typeof textEditor === 'undefined') {
// Create a new editor with the formatted JSON
try {
return await newEditorWithContent(json);
return await newEditorWithContent(result.format);
} catch (error) {
vscode.window.showErrorMessage('Unable to create a new editor with the JSON 😟: ' + error);
errorShown = true;
throw error;
};
} else {
Expand All @@ -50,7 +54,7 @@ export function activate(context: vscode.ExtensionContext) {
const firstLine = editor.document.lineAt(0);
const lastLine = editor.document.lineAt(editor.document.lineCount - 1);
const fullRange = new vscode.Range(firstLine.range.start, lastLine.range.end);
editBuilder.replace(fullRange, json);
editBuilder.replace(fullRange, result?.format || '');
});
return editor;
}
Expand Down Expand Up @@ -79,6 +83,7 @@ export function activate(context: vscode.ExtensionContext) {
const editorMap: { [key: string]: {editor: vscode.TextEditor, live: boolean }} = {};
const closeListener = vscode.workspace.onDidCloseTextDocument((doc) => {
const closedEditorId = doc.uri.toString();
//console.log('Closed editor: ' + closedEditorId);
if(closedEditorId in editorMap){
//This was a source editor, so remove it from the list
delete editorMap[closedEditorId];
Expand Down Expand Up @@ -148,6 +153,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(comReg_toFormat_Editor);
context.subscriptions.push(closeListener);
context.subscriptions.push(changeListener);
context.subscriptions.push(outputChannel);
}

export function deactivate() {}
Loading