fix:conflicts

This commit is contained in:
scales 2021-09-23 11:35:50 +08:00
commit 720d6c45f6
7 changed files with 295 additions and 126 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ tmp/
# vendor/
~$test.xlsx
lastupdate.tmp

View File

@ -30,7 +30,7 @@ func (c *TestPaperApiController) Display() {
var subTopic []models.SubTopic
var response responses.TestDisplay
_,err = testPaper.GetTestPaper(testId)
_, err = testPaper.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get test paper fail", err}
c.Data["json"] = resp
@ -62,16 +62,17 @@ func (c *TestPaperApiController) Display() {
response.SubTopics = append(response.SubTopics, tempSubTopic)
picName := testPaperInfo.Pic_src
//图片地址拼接 ,按服务器
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src := "C:\\Users\\yang\\Desktop\\阅卷系统\\img\\" + picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err!=nil {
if err != nil {
log.Println(err)
resp := Response{"30020", "get 图片显示异常 ", err}
c.Data["json"] = resp
return
}
encoding := base64.StdEncoding.EncodeToString(bytes)
tempTestPaperInfo :=responses.TestPaperInfoPlus{TestPaperInfo:testPaperInfo,PicCode:encoding }
tempTestPaperInfo := responses.TestPaperInfoPlus{TestPaperInfo: testPaperInfo, PicCode: encoding}
response.TestInfos = append(response.TestInfos, tempTestPaperInfo)
}
response.QuestionId = topic.Question_id
@ -141,10 +142,10 @@ func (c *TestPaperApiController) Point() {
}
scoreArr = append(scoreArr, j)
}
//获取该试卷大题 和抽象大题信息
//获取该试卷大题 和抽象大题信息
var test models.TestPaper
var topic models.Topic
_,err = test.GetTestPaper(testId)
_, err = test.GetTestPaper(testId)
if err != nil || test.Test_id == 0 {
resp := Response{"10002", "get test paper fail", err}
c.Data["json"] = resp
@ -156,7 +157,7 @@ func (c *TestPaperApiController) Point() {
c.Data["json"] = resp
return
}
//获取试卷未批改表信息(试卷批改状态类型)
//获取试卷未批改表信息(试卷批改状态类型)
var underTest models.UnderCorrectedPaper
err = underTest.GetUnderCorrectedPaper(userId, testId)
if err != nil || underTest.Question_id == 0 {
@ -185,7 +186,7 @@ func (c *TestPaperApiController) Point() {
newUnderTest := models.UnderCorrectedPaper{}
//随机 抽一个 人
newUnderTest.User_id =models.FindNewUserId(test.Examiner_first_id,test.Examiner_second_id,test.Question_id)
newUnderTest.User_id = models.FindNewUserId(test.Examiner_first_id, test.Examiner_second_id, test.Question_id)
newUnderTest.Test_question_type = 3
newUnderTest.Test_id = underTest.Test_id
newUnderTest.Question_id = underTest.Question_id
@ -202,7 +203,7 @@ func (c *TestPaperApiController) Point() {
// test.Leader_score = sum
// final = true
//}
if underTest.Test_question_type == 3 {
if underTest.Test_question_type == 3 {
test.Examiner_third_id = userId
test.Examiner_third_score = sum
first := math.Abs(float64(test.Examiner_third_score - test.Examiner_first_score))
@ -350,7 +351,7 @@ func (c *TestPaperApiController) Problem() {
c.Data["json"] = resp
return
}
_,err = test.GetTestPaper(testId)
_, err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10004", "get testPaper fail", err}
c.Data["json"] = resp
@ -392,7 +393,7 @@ func (c *TestPaperApiController) Answer() {
}
testId := requestBody.TestId
var test models.TestPaper
_,err = test.GetTestPaper(testId)
_, err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
@ -415,12 +416,13 @@ func (c *TestPaperApiController) Answer() {
return
}
//改成base64编码
for i:=0;i<len(tempString);i++ {
for i := 0; i < len(tempString); i++ {
picName := tempString[i]
//图片地址拼接 ,按服务器
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err!=nil {
if err != nil {
log.Println(err)
resp := Response{"30020", "get 图片显示异常 ", err}
c.Data["json"] = resp
@ -446,7 +448,7 @@ func (c *TestPaperApiController) ExampleDetail() {
log.Println(testId)
//____________________________________________________________
var test models.TestPaper
_,err = test.GetTestPaper(testId)
_, err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
@ -485,18 +487,19 @@ func (c *TestPaperApiController) ExampleDetail() {
return
}
//转64编码
for j:=0;j<len(temp);j++{
for j := 0; j < len(temp); j++ {
picName := temp[j].Pic_src
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err!=nil {
if err != nil {
log.Println(err)
resp := Response{"30020", "get 图片显示异常 ", err}
c.Data["json"] = resp
return
}
encoding := base64.StdEncoding.EncodeToString(bytes)
temp[j].Pic_src=encoding
temp[j].Pic_src = encoding
}
response.Test = append(response.Test, temp)
}
@ -517,7 +520,7 @@ func (c *TestPaperApiController) ExampleList() {
testId := requestBody.TestId
//----------------------------------------------------------------------
var testPaper models.TestPaper
_,err = testPaper.GetTestPaper(testId)
_, err = testPaper.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
@ -589,14 +592,14 @@ func (c *TestPaperApiController) ReviewPoint() {
}
var test models.TestPaper
_,err = test.GetTestPaper(testId)
_, err = test.GetTestPaper(testId)
if err != nil || test.Test_id == 0 {
resp := Response{"10002", "get test paper fail", err}
c.Data["json"] = resp
return
}
//判断是否二次阅卷
var topic models.Topic
var topic models.Topic
topic.GetTopic(test.Question_id)
scoreType := topic.Score_type
@ -604,27 +607,27 @@ func (c *TestPaperApiController) ReviewPoint() {
if test.Examiner_first_id == userId {
num = 0
test.Examiner_first_score = sum
if scoreType ==1 {
test.Final_score=sum
if scoreType == 1 {
test.Final_score = sum
}
var record models.ScoreRecord
record.GetRecordByTestId(testId,userId)
record.Score=sum
record.GetRecordByTestId(testId, userId)
record.Score = sum
record.Update()
} else if test.Examiner_second_id == userId {
num = 1
test.Examiner_second_score = sum
var record models.ScoreRecord
record.GetRecordByTestId(testId,userId)
record.Score=sum
record.GetRecordByTestId(testId, userId)
record.Score = sum
record.Update()
} else {
num = 2
test.Examiner_third_score = sum
var record models.ScoreRecord
record.GetRecordByTestId(testId,userId)
record.Score=sum
record.GetRecordByTestId(testId, userId)
record.Score = sum
record.Update()
}
err = test.Update()
@ -640,8 +643,8 @@ func (c *TestPaperApiController) ReviewPoint() {
testInfo.GetTestPaperInfo(testInfoId)
if num == 0 {
testInfo.Examiner_first_score = scoreArr[i]
if scoreType ==1 {
testInfo.Final_score=scoreArr[i]
if scoreType == 1 {
testInfo.Final_score = scoreArr[i]
}
} else if num == 1 {
testInfo.Examiner_second_score = scoreArr[i]
@ -656,4 +659,4 @@ func (c *TestPaperApiController) ReviewPoint() {
}
}
c.Data["json"] = Response{"10000", "ok", nil}
}
}

View File

@ -1 +1 @@
{"C:\\Users\\yang\\Desktop\\阅卷系统\\controllers":1631954147711626300}
{"C:\\Users\\yang\\Desktop\\阅卷系统\\controllers":1631954147711626300}

View File

@ -16,7 +16,7 @@ type ScoreRecord struct {
Score int64 `json:"score"`
Test_record_type int64 `json:"test_record_type"`
Problem_type int64 `json:"problem_type" xorm:"default(-1)"`
Test_finish int64 `json:"test_finish"`
Test_finish int64 `json:"test_finish"`
}
func (s *ScoreRecord) GetTopic(id int64) error {
@ -26,8 +26,8 @@ func (s *ScoreRecord) GetTopic(id int64) error {
}
return err
}
func (s *ScoreRecord) GetRecordByTestId(testId int64,userId string) error {
has, err := x.Where(builder.Eq{"test_id": testId}).Where("user_id=?",userId).Where("test_record_type !=0").Get(s)
func (s *ScoreRecord) GetRecordByTestId(testId int64, userId string) error {
has, err := x.Where(builder.Eq{"test_id": testId}).Where("user_id=?", userId).Where("test_record_type !=0").Get(s)
if !has || err != nil {
log.Println("could not find user")
}
@ -50,144 +50,142 @@ func GetLatestRecords(userId string, records *[]ScoreRecord) error {
return err
}
func CountProblemFinishNumberByQuestionId(questionId int64)(count int64,err error) {
record :=new (ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?",6).Count(record)
if err!=nil {
func CountProblemFinishNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?", 6).Count(record)
if err != nil {
log.Println("CountProblemFinishNumberByQuestionId err ")
}
return count,err1
return count, err1
}
func CountSelfScore(userId string,questionId int64)(count int64,err error) {
record :=new (ScoreRecord)
func CountSelfScore(userId string, questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=0").Where("user_id=?", userId).Count(record)
if err!=nil {
if err != nil {
log.Println("CountFailTestNumberByUserId err ")
}
return count ,err1
return count, err1
}
func CountFailTestNumberByUserId(userId string,questionId int64)(count int64,err error) {
record :=new (ScoreRecord)
func CountFailTestNumberByUserId(userId string, questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=5").Where("user_id=?", userId).Count(record)
if err!=nil {
if err != nil {
log.Println("CountFailTestNumberByUserId err ")
}
return count,err1
return count, err1
}
func CountProblemNumberByQuestionId(questionId int64)(count int64) {
record :=new (ScoreRecord)
count, err := x.Where("question_id = ?", questionId).Where("test_record_type=?",5).Count(record)
if err!=nil {
func CountProblemNumberByQuestionId(questionId int64) (count int64) {
record := new(ScoreRecord)
count, err := x.Where("question_id = ?", questionId).Where("test_record_type=?", 5).Count(record)
if err != nil {
log.Println("CountProblemNumberByQuestionId err ")
}
return count
}
func CountArbitramentFinishNumberByQuestionId(questionId int64)(count int64,err error) {
record :=new (ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?",4).Count(record)
if err!=nil {
func CountArbitramentFinishNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?", 4).Count(record)
if err != nil {
log.Println("CountArbitramentFinishNumberByQuestionId err ")
}
return count,err1
return count, err1
}
func CountFinishScoreNumberByQuestionId(questionId int64)(count int64 ,err error) {
record :=new (ScoreRecord)
func CountFinishScoreNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_finish=1").Count(record)
if err!=nil {
if err != nil {
log.Println("CountFinishScoreNumberByQuestionId err ")
}
return count,err1
return count, err1
}
func FindFinishTestNumberByUserId(scoreRecord *[]ScoreRecord,userId string,questionId int64)( err error) {
err1 := x.Where("question_id = ?", questionId).Where("user_id=?",userId).Where("test_finish=1").Find(scoreRecord)
if err!=nil {
func FindFinishTestNumberByUserId(scoreRecord *[]ScoreRecord, userId string, questionId int64) (err error) {
err1 := x.Where("question_id = ?", questionId).Where("user_id=?", userId).Where("test_finish=1").Find(scoreRecord)
if err != nil {
log.Println("FindFinishTestNumberByUserId err ")
}
return err1
}
func CountFirstScoreNumberByQuestionId(questionId int64)(count int64 ,err error) {
record :=new (ScoreRecord)
count, err1:= x.Where("question_id = ?", questionId).Where("test_record_type=?",1).Count(record)
if err!=nil {
func CountFirstScoreNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?", 1).Count(record)
if err != nil {
log.Println("CountFirstScoreNumberByQuestionId err ")
}
return count ,err1
return count, err1
}
func CountSecondScoreNumberByQuestionId(questionId int64)(count int64 ,err error) {
record :=new (ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?",2).Count(record)
if err!=nil {
func CountSecondScoreNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?", 2).Count(record)
if err != nil {
log.Println("CountSecondScoreNumberByQuestionId err ")
}
return count,err1
return count, err1
}
func CountThirdScoreNumberByQuestionId(questionId int64)(count int64,err error) {
record :=new (ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?",3).Count(record)
if err!=nil {
func CountThirdScoreNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_record_type=?", 3).Count(record)
if err != nil {
log.Println("CountThirdScoreNumberByQuestionId err ")
}
return count,err1
return count, err1
}
func CountFinishTestNumberByUserId(userId string,questionId int64)(count int64,err1 error) {
record :=new (ScoreRecord)
func CountFinishTestNumberByUserId(userId string, questionId int64) (count int64, err1 error) {
record := new(ScoreRecord)
count, err := x.Where("question_id = ?", questionId).Where("test_finish=1").Where("user_id=?", userId).Count(record)
if err!=nil {
if err != nil {
log.Println("CountFinishTestNumberByUserId err ")
}
return count,err
return count, err
}
func SumFinishScore(userId string,questionId int64)(sum float64,err1 error) {
record :=new (ScoreRecord)
sum, err := x.Where("question_id = ?", questionId).Where("test_record_type!=0").Where("user_id=?", userId).Sum(record,"score")
if err!=nil {
func SumFinishScore(userId string, questionId int64) (sum float64, err1 error) {
record := new(ScoreRecord)
sum, err := x.Where("question_id = ?", questionId).Where("test_record_type!=0").Where("user_id=?", userId).Sum(record, "score")
if err != nil {
log.Println("SumFinishScore err ")
}
return sum,err
return sum, err
}
func FindFinishScoreRecordListByQuestionId (scoreRecordList *[]ScoreRecord , questionId int64) error{
err := x.Where("question_id = ?",questionId).Find(scoreRecordList)
if err!=nil {
func FindFinishScoreRecordListByQuestionId(scoreRecordList *[]ScoreRecord, questionId int64) error {
err := x.Where("question_id = ?", questionId).Find(scoreRecordList)
if err != nil {
log.Println("FindFinishScoreRecordListByQuestionId err ")
}
return err
return err
}
func FindSelfScoreRecordByUserId(selfScoreRecord *[] ScoreRecord,examinerId string)error {
func FindSelfScoreRecordByUserId(selfScoreRecord *[]ScoreRecord, examinerId string) error {
err := x.Where("user_id=?", examinerId).Where("test_record_type =?",0).Find(selfScoreRecord)
if err!=nil {
err := x.Where("user_id=?", examinerId).Where("test_record_type =?", 0).Find(selfScoreRecord)
if err != nil {
log.Println("FindSelfScoreRecordByUserId err ")
}
return err
}
func GetTestScoreRecordByTestIdAndUserId(testScoreRecord *ScoreRecord,testId int64,examinerId string) error {
func GetTestScoreRecordByTestIdAndUserId(testScoreRecord *ScoreRecord, testId int64, examinerId string) error {
_, err := x.Where("user_id=?", examinerId).Where("test_id =?", testId).Where(" test_score_type !=?", 0).Get(testScoreRecord)
if err!=nil {
if err != nil {
log.Println("FindSelfScoreRecordByUserId err ")
}
return err
}
func CountTestByScore(question int64, score int64) (count int64,err1 error){
func CountTestByScore(question int64, score int64) (count int64, err1 error) {
scoreRecord := new(ScoreRecord)
count, err := x.Where("score = ?", score).Where("question_id=?",question).Count(scoreRecord)
if err!=nil {
count, err := x.Where("score = ?", score).Where("question_id=?", question).Count(scoreRecord)
if err != nil {
log.Println("CountTestByScored err ")
}
return count,err
return count, err
}
func (s *ScoreRecord) Update() error {
code, err := x.Where(builder.Eq{"test_id": s.Test_id}).Update(s)
code, err := x.Where(builder.Eq{"test_id": s.Test_id}).AllCols().Update(s)
if code == 0 || err != nil {
log.Println("update ScoreRecord fail")
log.Printf("%+v", err)
}
return err
}
}

View File

@ -26,7 +26,6 @@ type TestPaper struct {
Final_score_id string `json:"finale_score_id"`
Pratice_error int64 `json:"pratice_error"`
Correcting_status int64 `json:"correcting_status"`
}
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64, question_statue int64) error {
@ -46,17 +45,17 @@ func GetTestPaperListByQuestionIdAndQuestionStatus(question_id int64, question_s
return err
}
func (t *TestPaper) GetTestPaper(id int64) (bool,error) {
func (t *TestPaper) GetTestPaper(id int64) (bool, error) {
has, err := x.Where(builder.Eq{"test_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find test paper")
}
return has,err
return has, err
}
func (t *TestPaper) Update() error {
code, err := x.Where(builder.Eq{"test_id": t.Test_id}).Update(t)
if code == 0 || err != nil {
code, err := x.Where(builder.Eq{"test_id": t.Test_id}).AllCols().Update(t)
if code == 0 && err != nil {
log.Println("update test paper fail")
log.Printf("%+v", err)
}
@ -64,14 +63,14 @@ func (t *TestPaper) Update() error {
}
func (t *TestPaper) Insert() error {
code, err := x.Insert(t)
if code == 0 || err != nil {
if code == 0 && err != nil {
log.Println("insert test paper fail")
log.Printf("%+v", err)
}
return err
}
func FindTestPaperByQuestionId(question_id int64, t *[]TestPaper) error {
func FindTestPaperByQuestionId(question_id int64, t *[]TestPaper) error {
err := x.Where("question_id = ? and correcting_status = ?", question_id, 0).Find(t)
if err != nil {
log.Println("could not FindTestPaperByQuestionId ")
@ -79,20 +78,19 @@ func FindTestPaperByQuestionId(question_id int64, t *[]TestPaper) error {
}
return err
}
func FindUnDistributeTest(id int64 , t*[]TestPaper) error {
err := x.Where("question_id=?",id).Where("correcting_status=?",0).Find(t)
func FindUnDistributeTest(id int64, t *[]TestPaper) error {
err := x.Where("question_id=?", id).Where("correcting_status=?", 0).Find(t)
if err != nil {
log.Println("could not GetUnDistributeTest")
}
return err
}
func CountTestDistributionNumberByQuestionId(questionId int64)(count int64,err error) {
testPaper :=new (TestPaper)
count, err1 := x.Where("question_id = ?", questionId).Where("correcting_status=?",1).Count(testPaper)
if err!=nil {
func CountTestDistributionNumberByQuestionId(questionId int64) (count int64, err error) {
testPaper := new(TestPaper)
count, err1 := x.Where("question_id = ?", questionId).Where("correcting_status=?", 1).Count(testPaper)
if err != nil {
log.Println("CountTestDistributionNumberByQuestionId err ")
}
return count,err1
}
return count, err1
}

View File

@ -36,7 +36,7 @@ func (t *TestPaperInfo) GetTestPaperInfoByTestIdAndQuestionDetailId(testId int64
func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
has, err := x.Where(builder.Eq{"test_detail_id": id}).Get(t)
if !has || err != nil {
if !has && err != nil {
log.Println("could not find test paper info")
log.Println(err)
}
@ -44,8 +44,8 @@ func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
}
func (t *TestPaperInfo) Update() error {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).Update(t)
if code == 0 || err != nil {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).AllCols().Update(t)
if code == 0 && err != nil {
log.Println("update test paper info fail")
log.Println(err)
}

169
tstex_modules/_api.ts Normal file
View File

@ -0,0 +1,169 @@
//THIS FILE DEFINES TS-TEX's API AND SHOULD NOT BE EDITED. IF EDITED YOU CAN REWRITE THIS FILE USING TsApiFile.rewrite().
//CHANGING ANY OF THIS CONTENT WILL NOT AFFECT THE ACTUAL API THAT IS EXPOSED BY THE RUNTIME AND THEREFORE WILL HAVE NO EFFECT!
export interface IRange
{
start: ILocation;
end: ILocation;
}
export interface ILocation
{
offset: number;
line: number;
column: number;
}
export abstract class ScopeAbstract
{
abstract input(file: string): string;
abstract configure(key: string, value: any);
abstract config<T>(key: string): T;
abstract fn(fn: () => any);
abstract eval(code: string);
abstract str(o: any): string;
abstract get state(): "idle"|"building";
workdir: string;
}
export interface IResolvable
{
}
export type IRootNode = IFnNode | ITextNode;
export type NodeType = "fn" | "text" | "parameter" | "parametersep" | "fnname" | "parameterlist" | "typeannotation" | "comment";
export interface INode
{
range: IRange;
type: NodeType;
}
export interface ITextNode extends INode
{
getText(filetext: string);
}
export interface IFnNode extends INode
{
complete: boolean;
parameters: IParameterListNode;
name: IFnNameNode;
getStatementText(filetext: string);
}
export interface IFnNameNode extends INode
{
name: string;
}
export interface IParameterListNode extends INode
{
parameters: IParameterNode[];
}
export interface IParameterNode extends INode
{
annotation: IAnnotationNode;
}
export interface IParameterSeperatorNode extends INode {}
export interface IAnnotationNode extends INode {}
export interface IResolver
{
resolve<T>(type: string, key?: string): T;
register(object: any, type: string, key?: string);
unregister(object: any);
}
export interface ISourceFile
{
path: string;
nodes: IRootNode[];
text: string;
}
export interface ILifecycleHookComponent
{
_prebuild?();
_postbuild?();
_init?();
_finalize?();
_resolvable?: boolean;
_resolver: IResolver;
}
export interface IModule extends ILifecycleHookComponent
{
}
export interface ILoggerFactory
{
getLogger(componentName: string): ILogger;
registerLogLambda(lambda: (component: string, message: string, level?: LogLevel, error?: any) => any);
}
export enum LogLevel
{
Debug, Verbose, Info, Warn, Error
}
export interface ILogger
{
log(message: string, level?: LogLevel, error?: any);
}
export interface IDiagnostic
{
message: string;
level: DiagnosticLevel;
location: IOffsetRange;
}
export interface IOffsetRange
{
start: number;
end: number;
}
export type DiagnosticLevel = "fatal"|"warn"|"error"|"info";
export class DiagnosticError extends Error
{
diagnostic: IDiagnostic;
constructor(message: string, level: DiagnosticLevel, location: IOffsetRange = null)
{
super(message);
location = location || {
start: 0,
end: null
};
this.diagnostic = {
message,
level,
location
};
}
}
export interface ICompletionItem
{
name: string;
sortText: string;
insertText?: string;
hasAction?: true;
source?: string;
isRecommended?: true;
}
export interface ICompletionItemProvider extends ILifecycleHookComponent
{
provideCompletionItems(triggerChar: string, node: IRootNode, file: ISourceFile): ICompletionItem[];
}
export const l = String.raw;
export const SCOPE: ScopeAbstract = null;
export const RESOLVER: IResolver = null;