Skip to content

Commit

Permalink
Updating before publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Drew committed Feb 10, 2025
1 parent 6346e16 commit 1eb7bfc
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Status, StatusBarEntry } from './utils/status';

let lspPort: number = 2089;
let serverPort: number = 4000;
const startLucee: boolean = false; //Set to false if you want to use your own server
const startLucee: boolean = true; //Set to false if you want to use your own server
const socket_timeout = 5000; //Not used, this would be a timeout for the startServer function
const outputChannel = window.createOutputChannel("CFML Formatter");
let lspjar: String;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Mark Drew",
"preview": true,
"license": "MIT",
"version": "1.0.60",
"version": "1.0.66",
"publisher": "markdrew",
"repository": {
"type": "git",
Expand Down Expand Up @@ -49,11 +49,11 @@
]
},
"scripts": {
"vscode:prepublish": "npm version patch --no-git-tag-version && npm run compile",
"vscode:prepublish": "npm version patch --no-git-tag-version && npm run compile && cd server && ant",
"compile": "tsc -b",
"watch": "tsc -b -w",
"postinstall": "cd client && npm install && cd ..",
"vscode:package": "cd server && ant && cd .. && vsce package --allow-missing-repository"
"vscode:package": "vsce package --allow-missing-repository"
},
"devDependencies": {
"typescript": "^5.7.3"
Expand Down
4 changes: 2 additions & 2 deletions resources/lucee_lsp-1.0-all.jar
Git LFS file not shown
13 changes: 11 additions & 2 deletions server/src/main/cfml/cfformat/models/CFFormat.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ component accessors="true" {
variables.tagData = deserializeJSON(fileRead(rootFolder & 'data/tags.json'));
variables.platform = getPlatform();
variables.lf = platform == 'windows' ? chr(13) & chr(10) : chr(10);

variables.executable = binFolder & 'cftokens' & (platform == 'windows' ? '.exe' : '');
variables.executable = binFolder & 'cftokens';

if(platform == 'windows') {
variables.executable = binFolder & 'cftokens.exe';
} else if(platform == 'osx') {
variables.executable = binFolder & 'cftokens_osx';
} else {
variables.executable = binFolder & 'cftokens_linux';
}



this.cfscript = new CFScript(this);
this.cftags = new CFTags(this);
Expand Down
3 changes: 1 addition & 2 deletions server/src/main/cfml/lsp/ConfigStore.cfc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
component accessors="true" {

property name="Config";

property name="Config" type="struct";

}
3 changes: 2 additions & 1 deletion server/src/main/cfml/lsp/methods/textDocument.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ component accessors="true" {
FileWrite(filename, theDoc);
// TODO: figure out how we get these, either from file or as a .cfformat file
var settings={};
var loadSettings = findConfigFile(message.params.textDocument.uri, getConfigStore().getConfig().rootURI);
var rootURI=getConfigStore().getConfig().rootURI;
var loadSettings = findConfigFile(message.params.textDocument.uri,rootURI);
if(isJSON(loadSettings)){
settings = deserializeJSON(loadSettings);
}
Expand Down
58 changes: 58 additions & 0 deletions server/src/main/cfml/tests/specs/lsp/methods/textDocumentTest.cfc
Original file line number Diff line number Diff line change
@@ -1,6 +1,64 @@
component extends="testbox.system.BaseSpec" {

function run(){


describe("format", ()=>{
var documentStore = createMock("lsp.TextDocumentStore");


var configStore = new lsp.ConfigStore(
Config={
"rootURI":"/tmp"
}
);


var cfFormat = createMock("cfformat.models.CFFormat");
cfFormat.$("formatFile", "FORMATTED");

var textDocument = new lsp.methods.textDocument();
textDocument.setTextDocumentStore(documentStore);
textDocument.setConfigStore(configStore);
textDocument.setCFFormat(cfFormat);


var td = new lsp.beans.TextDocumentItem(argumentCollection={
"uri":"file:///path/to/file.cfc",
"languageId":"cfml",
"version":1,
"text":"<cfscript></cfscript>"
});

prepareMock(textDocument);
textDocument.$("findConfigFile", "{}");

makePublic(textDocument, "findConfigFile");

documentStore.$("getDocument").$args("file:///path/to/file.cfc").$results( td );

it( "should format a document", function(){

var ret = textDocument.formatting({
"jsonrpc": "2.0",
"id": 1,
"method": "textDocument/format",
"params": {
"textDocument": {
"uri": "file:///path/to/file.cfc"
}
}
});

expect(ret).toBeStruct();
expect(ret).toHaveKey("jsonrpc");

//TODO: Validate this struct to schema

debug(ret);

});
});
describe("updateDocument", ()=>{

// Configure the BeanFactory:
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/resources/lucee_lsp.war
Git LFS file not shown

0 comments on commit 1eb7bfc

Please sign in to comment.